Passing dynamic array to struct in c++ -
I've noticed that someone tries to use a dynamic size for an array that is global at some point Uses stability. What I am trying to do is to pass through an integer variable, which is determined by the user for the structure that I create an array of that size, thus dynamic Obviously the code below is not working, but this tells you what I plan to complete
struct node {char input; Inti gameboard [shape]; Node * pNext; }; int main () {cout & lt; & Lt; "Enter board size" & lt; & Lt; Endl; CIN & gt; & Gt; Shape; Inti gameboard [shape]; }
structure node {int countr; Int gameboard []; }; Int countr; ... straight node * p = malloc (offset (node, playboard) + counter * size * P-> playingboard); P-> Counter = counter; ... or an independent dynamically assigned array
struct node {int countr; Int * playBoard; }; Node holder; ... holder Playingboard = Malloke (Holder Quote * Holder * Holder. Playingboard);
Comments
Post a Comment