c++ - Assign struct member from loop? -


i have struct data type

struct column {     int member1;     int member2; }; 

and have loop

counter=1;  for(counter; counter <= input_column; counter++) {     printf("%d", counter);   } 

how assign every loop counter member of struct column?

example : if user inputs 5, struct column members should become this:

struct column {     int member1;     int member2;     int member3;     int member4;     int member5; }; 

thank in advance :)

the short answer can't. struct type, size, variables, , methods know , set @ compile time. however, can use array or std::vector<t> store multiple values.


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -