Develop a C program to initialize the 2-D array and display its elements.
Code
#include <stdio.h>int main(){int i = 0, j = 0;int arr[4][3] = {{1, 2, 3}, {2, 3, 4}, {3, 4, 5}, {4, 5, 6}};//traversing 2D arrayfor (i = 0; i < 4; i++){for (j = 0; j < 3; j++){printf("arr[%d] [%d] = %d \n", i, j, arr[i][j]);} //end of j} //end of ireturn 0;}
Output
Welcome to 2D world lmao
0 Comments
Post a Comment