int main() {
int my array[3][3] =
10, 23, 42,
1, 654, 0,
40652, 22, 0
};
printf(\"%d\\n\", my_array[3][3]);
return 0;
}
If you want to print the array like you print a 2D list in Python:
#include
int main()
{
int i, j;
int my_array[3][3] = {{10, 23, 42}, {1, 654, 0}, {40652, 22, 0}};
for(i = 0; i < 3; i++)
{
if (i == 0) {
printf("[");
}
printf("[");
for(j = 0; j < 3; j++)
{
printf("%d", my_array[i][j]);
if (j < 2) {
printf(", ");
}
}
printf("]");
if (i == 2) {
printf("]");
}
if (i < 2) {
printf(", ");
}
}
return 0;
}
Output will be:
[[10, 23, 42], [1, 654, 0], [40652, 22, 0]]