a[4][3]={{1,2,3},{1,2,3},{1,2,3},{1,2,3}};
时间: 2023-09-26 19:11:08 浏览: 17
This is a two-dimensional array in C++, with 4 rows and 3 columns. The values in the array are initialized to {{1,2,3},{1,2,3},{1,2,3},{1,2,3}}.
To access a specific element in the array, you can use the syntax a[i][j], where i is the row index and j is the column index. For example, to access the element in the second row and third column, you would use a[1][2] (remember that array indices start at 0 in C++).
Here's an example of how you could print out all the elements in the array:
```
#include <iostream>
using namespace std;
int main() {
int a[4][3] = {{1,2,3},{1,2,3},{1,2,3},{1,2,3}};
// loop through each row and column of the array
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 3; j++) {
// print out the element at this row and column
cout << a[i][j] << " ";
}
// move to the next row (print a newline character)
cout << endl;
}
return 0;
}
```
This would output:
```
1 2 3
1 2 3
1 2 3
1 2 3
```