Friday, June 24, 2016

C program to understand the concept of initialization in 2D arrays

#include<stdio.h>
void main()
{
//here inner curly braced values will be assigned to 0th array and outer to 1th array
 int arr_new[3][4]={{1,2},3,4};
 arr_new[2][3]=0;
 printf("\n%d %d %d %d %d",arr_new[0][0],arr_new[0][1],arr_new[0][2],arr_new[1][0],arr_new[1][1]);
}

output-
1 2 0 3 4

No comments:

Post a Comment