quote:Original post by Plasmite
I used to do 2d-arrays with pointers to pointers. So that I basicly had arrays of arrays. I had a function declared like this
int function(char **parameter);
Everything worked fine. I usually declared my arrays like this
char **array;
and then alloacted memory for it. One day I tried this way of declaring the array
char array[5][10];
and I wasn''t sure wheter it would work, but I desided to try. I called the function like this
function(array);
and assumed, that if the array would be really just one array, 50 bytes long, my compiler would give me a warning. Compiler did not mention anything! And I assumed everything was fine, but the program did not work. Since my program did not work, I assume my array wasn''t really a array of arrays, (I guess this was correct, according to your discussion here). But I still wonder what my c-compiler was thinking about it? If I declare an variable like this:
char *variable;
I shouldn''t be able to put it as a parameter of function, if it is declared as
int function(char **array);
???
perhaps trying int function(char[][] array) would help, since in C++ the array type is slightly different than just being a pointer.