how to initialize 2D array.
following is not a code but just for my concept, plz tell if it is correct
n how
array having x rows n y columns
array=(int **)malloc(x*sizeof(int *)
for(i=0;i<;i++)
array[i]=(int *)malloc(y*sizeof(int))
thanks
how to initialize 2D array.
following is not a code but just for my concept, plz tell if it is correct
n how
array having x rows n y columns
array=(int **)malloc(x*sizeof(int *)
for(i=0;i<;i++)
array[i]=(int *)malloc(y*sizeof(int))
thanks
Yes, just like that, without the casts.
Numerous posts (some of them very recent) show you how.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.