0
How to write a 2 dimensional array of the form a[3][3]
Program in c or c++
5 odpowiedzi
+ 1
Use a double for loop, each over the length of your dimensions, and fill the slots of your array one by one.
+ 1
Static way
int a[3][3] = { {0,1,2}, {1,2,3}, {2,3,4} };
+ 1
Non static way
int a[3][3];
for(int i = 0; i <3; i++) {
for(int j = 0; j<3; j++) {
a[i][j] = i + j;
}
}
+ 1
That's nice, homework done, so now Arthur can go play.
0
Perhaps he learnt something. Fingers crossed. I guess he will keep his HTML courses going