Friday, May 21, 2010

I'm trying to work with 2D array in C but i'm getting an error "size of type unknown or zero"what should i do?

use pointer


int **arrayptr


arrayptr = (int**)x*malloc(sizeof(int*));


for(i=0;i%26lt;x;i++)


arrayptr[i]=(int*)y*malloc(sizeof(int)...

I'm trying to work with 2D array in C but i'm getting an error "size of type unknown or zero"what should i do?
in declaration section write such as





int row=31, colon=34;


int arrayname[row][colon];
Reply:u have to define the size of the column and line
Reply:make sure you put the size of your array... for example


int x = 2;


int y = 3;


int number[ x ][ y ];





// x stands for row size


// y stands for column size

petal

No comments:

Post a Comment