C LANGUAGE - 24: 2D ARRAYS AND NESTED LOOPS
HERE, WE WILL SEE ABOUT 2D ARRAYS AND NESTED LOOPS IN C.
#include<stdio.h>
#include<stdlib.h>
int main() {
int nums[3][2] = {
{1, 2},
{3, 4},
{5, 6}
};
// printf("%d", nums[2][1]);//
//NESTED FOR LOOPS//
int i, j;
for (i = 0; i < 3; i++){
for(j = 0; j < 2; j++){
printf("%d,", nums[i] [j]);
}
printf("\n");
}
return 0;
}
Comments
Post a Comment