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
This is a discussion on initialize 2D array! within the C Programming forums, part of the General Programming Boards category; how to initialize 2D array. following is not a code but just for my concept, plz tell if it is ...
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.
I support http://www.ukip.org/ as the first necessary step to a free Europe.