Ask your own question, for FREE!
Computer Science 21 Online
OpenStudy (anonymous):

When using a struct to contain a 2D char array, how do you make the size of the array? (using C) ex. typedef struct{ char board[][]; }gameBoard; So I would declare a gameBoard with: gameBoard board1; correct? This creates a board, but I don't know how I would create a size for the 2D array. I think you have to use -> to get to the 2D array inside, but don't know how to properly size it.

OpenStudy (anonymous):

i think from what i know, u need to have a constant number with in the arry for example char board[100][100], something like that, just to declare the array

OpenStudy (e.mccormick):

Are you trying to make it dynamicly sized?

OpenStudy (anonymous):

In this case I would want the array to be a different size for each case I make this struct. I want to be able to give it a specific size depending on the case.

OpenStudy (anonymous):

Do you know how pointers work?

OpenStudy (anonymous):

|dw:1382302539500:dw|

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!