মাল্টি ডাইমেনশনাল অ্যারে
int a[3][4] = {
{0, 1, 2, 3} , // values for first row, index 0
{4, 5, 6, 7} , // values for second row, index 1
{8, 9, 10, 11} // values for third row, index 2
};
int b[3][4] = {0,1,2,3,4,5,6,7,8,9,10,11}; // this works too#include <stdio.h>
int main (void)
{
int a[3][4] = {
{0, 1, 2, 3} , // values for first row, index 0
{4, 5, 6, 7} , // values for second row, index 1
{8, 9, 10, 11} // values for third row, index 2
};
int i, j;
// output each array element's value
for ( i = 0; i < 3; i++ )
{
for ( j = 0; j < 4; j++ )
{
printf("a[%d][%d] = %d", i,j, a[i][j] );
}
printf("\n");
}
return 0;
}Last updated