1. #include"stdio.h"
int main()
{
int array[5]={1,2,3},i;
for(i=0;i<5;i++)
printf("%d ,",array[i]);
printf("%d ,",array[3]+array[4][GP1] );
}
1 ,2 ,3 ,0 ,0 ,0 ,请按任意键继续. . .
2.请看:
思考:b[2]~b[4]的值是多少?为什么?
3.请看:
4.
5. #include"stdio.h"
int main()
{
int array[4][4]={{1},{0,1},{1},{1}};[GP2]
int i,j;
for (i=0;i<4;i++)
{
for (j=0;j<4;j++)
printf("%d ,",array[i][j]);
puts(" ");
}
}
运行结果:
1 ,0 ,0 ,0 ,
0 ,1 ,0 ,0 ,
1 ,0 ,0 ,0 ,
1 ,0 ,0 ,0 ,
请按任意键继续. . .
#include"stdio.h"
int main()
{
int array[4][4]={{},{},{},{}};
int i,j;
for (i=0;i<4;i++)
{
for (j=0;j<4;j++)
printf("%d ,",array[i][j]);
puts(" ");
}
}
运行结果:
0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,
0 ,0 ,0 ,0 ,
请按任意键继续. . .
#include"stdio.h"
int main()
{
int array[4][4]={{1},{0,1},{0,0,1},{0,0,0,1}};
int i,j;
for (i=0;i<4;i++)
{
for (j=0;j<4;j++)
printf("%d ,",array[i][j]);
puts(" ");
}
}
运行结果:
1 ,0 ,0 ,0 ,
0 ,1 ,0 ,0 ,
0 ,0 ,1 ,0 ,
0 ,0 ,0 ,1 ,
请按任意键继续. . .