Quote Originally Posted by ypramesh
I (dynamically) allocated memory for a 2D array. I realize that I must declare the 2nd dimension above the main function, but I do NOT know the value of this second dimension.
ex.
void rand_gen(int need_num, int array[][], int dim);

Later on in the program, the user is asked to enter the dim (dimension) values.
How do I correctly declare this function?

this part of a big sliding numbers assignment (it is big for me!)
i really appreciate any help. Thankx in advance!
may help come to you when you need it
If you know how many columes (arrays) you'll need at compile time, then you could use an array of pointers:

char *arrptr[COLUMES];

On the other hand, if you do not know how many arrays you'll need at compile time, than you can create the arrays dynamically at runtime via malloc, using a pointer to a pointer:
Code:
 char** pp;
pp = malloc(COLUMES * sizeof(*pp));

for ( i = 0; i < COLMUES; ++i )
      pp[i] = malloc(ROWS/*elements per array*/  * sizeof(**pp));