I have a variable type:
char (*p)[12] = calloc(n, sizeof(*p));
I need the variable to stay this way, but I am having trouble passing it as a parameter due to the function type giving me errors:
void myMethod(char *p) { ... }
What can I use in myMethod as the parameter to make this work?
Use the same type for the parameter as you did for the variable:
Remember that
pis a pointer to a 12-element array ofchar, not a simple pointer tochar. Thus, the type ofp[i]will bechar [12](which in most cases will decay tochar *).