Sending a pointer to multi-dim array to a function
Is it wrong to do this:
Code:
int data[20][30];
int *dPtr = data[0];
myFunc( dPtr, 20, 30 );
I want to send a multi-dim array to a function, but I want to have the function accept an array of any size. The sizes of each dimension are sent as arguments though, so I'm not flying blind.
I mean, I know this works, but I just want to know if I would be shot in a commercial environment for doing it?
And if it is evil, how else can I send multi-dim arrays to functions without explicitly specifying their length? Are VLAs the only way?