Wednesday, April 25, 2012

C Program: newbie trying to pass 2D string array into a function

Programming in C ( with -std=C89), and running into errors trying to pass a character string array into a function.

In main(), I've declared the array as follows:

#define ROWS 501
#define COLS 101
void my_function( char **);
char my_array[ROWS][COLS];

In my_function, I've declared the array as:

void my_function( char **my_array )

I'm getting this error:

warning: passing argument 1 of 'my_function' from incompatible pointer type,
note: expected 'char **' but argument is of type 'char (*)[101]

No comments:

Post a Comment