Assign values row wise as follows:
int main() { int arr[3][3] = {{10}, {20,30}, {0,40}}, i, j; printf(“Array elements are : \n”); for(i=0 ; i<3 ; i++) { for(j=0 ; j<3 ; j++) { printf(“%d \t”, arr[i][j]); } printf(“\n”); } } |
Write a program to find the size of two-dimensional array:
#include<stdio.h> int main() { int a[3][3]; printf(“Total size : %d \n”, sizeof(a)); printf(“Element size : %d \n”, sizeof(a[0][0])); printf(“Length : %d \n”, sizeof(a)/sizeof(a[0][0])); printf(“Row size : %d \n”, sizeof(a[0])); printf(“Row length : %d \n”, sizeof(a[0])/sizeof(a[0][0])); return 0; } |
