I want to initialize multidimensional array in C. I use usually the code below.
#include <stdio.h>
int main()
{
int a[10][10] = {{0}, {0}};
return 0;
}
Is my code right, and is there any specific, quick code for me?
I want to initialize multidimensional array in C. I use usually the code below.
#include <stdio.h>
int main()
{
int a[10][10] = {{0}, {0}};
return 0;
}
Is my code right, and is there any specific, quick code for me?
Initialization:
int a[3][4] = {
{0, 1, 2, 3} , /* initializers for row indexed by 0 */
{4, 5, 6, 7} , /* initializers for row indexed by 1 */
{8, 9, 10, 11} /* initializers for row indexed by 2 */
};
And with for loops:
int i,j,a[10][10];
for(i=0;i<10;i++)
for(j=0;j<10;j++)
a[i][j] = 1;