| Bv202 (195) | |||
|
Hey, I know you can assign values to a mutidimensional array this way:
The declaration of my array in done in my class: private: int numbers[2][3]; Now I would like to assign the values row per row in my constructor, but this is not possible: numbers[0][] = {1, 3, 4}; Is there a way to do this? I know I can likely assign these when declaring array, but as the numbers got calculated in the constructor, I have to do it this way. Thanks | |||
|
Last edited on
|
|||
| Null (754) | |
Try numbers[0]={1,2,3};
| |
|
|
|
| Bv202 (195) | |
|
Nope :( error C2059: syntax error : '{' error C2143: syntax error : missing ';' before '{' error C2143: syntax error : missing ';' before '}' | |
|
|
|
| emesaeler (2) | |||
Maybe I'm wrong, but I believe it has to be accomplished with a loop. Place new column data into a new 1d array and iterate through the individual positions, copying into 2nd row of 2d array.
| |||
|
|
|||
| Bv202 (195) | |
|
So you really have to assign them one by one? Ok, thanks :) | |
|
|
|