C print 2D array
#include <stdio.h>
int main() {
// Declare a 2D array with 3 rows and 4 columns
int twoDArray[3][4] = {
{1, 2, 3, 4},
{5, 6, 7, 8},
{9, 10, 11, 12}
};
// Nested loops to iterate through each element of the array
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 4; j++) {
// Print the element at the current row and column
printf("%d ", twoDArray[i][j]);
}
// Move to the next line after printing each row
printf("\n");
}
return 0;
}