I am trying to reassign a pointer to a 3-dimensional array.
include <stdio.h>
int main()
{
int type;
char database_of_names[3][50][16];
char database_of_suffixes[10][50][16];
char (*databaseP)[][50][16];
...
if(type == 0)
(*databaseP)[][50][16] = &database_of_names; // Runtime error
else if(type ==1)
(*databaseP)[][50][16] = &database_of_suffixes; // Runtime error
...
return 0;
}
I can initialize the pointer at the point of declaration like this:
char (*databaseP)[][50][16] = &database_of_names; // works
but I want to be able to switch the assignment. How can I do this by changing to above code?
Thanks