Creating a function to return 2d arrays help please
Hello,
I am trying to create a function outside of the main method which creates a 2d array based on two numbers given to it. I want to be able to run this function multiple times to create a number of arrays to be accessed later.
Code:
char *room(int xRoom, int yRoom){
static char charRoom[xRoom][yRoom];
return charRoom;
}
At the moment it throws up compiler errors as the array length isn't constant. Am I going about what I want to do the right way or is there another? Or if I am how do I continue from this point onwards?