0

I have a function that I want to accept 2D arrays of arbitrary size.

So if I have the following:

char names[100][10];
char values[100][5];

What should my function signature look like?

I tried:

void myFunc(char* names[], char* values[]); and void myFunc(char** names, char** values);

But then I get argument of type "char(*)[10]" is incompatible with parameter of type "char**".

I tried:

void myFunc(char names[][], char values[][]);

But then I get an array may not have elements of this type.

The only thing that works is void myFunc(char names[100][10], char values[100][5]);

But then it's not arbitrary size. I'm aware that I'll need to pass a size parameter as well, but I can't even get to that yet.

Legion
  • 3,295
  • 7
  • 39
  • 78

0 Answers0