#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
int main(){
/*一维数组*/
int sS[99] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
for (int i = 0; i <20; i++)
{
printf("%d\t",sS[i]);
}
printf("\n");
int t[99] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 };
for (int i = 0; i <20; i++)
{
printf("%d\t", &t[i]);
}
/*二维数组*/
int a[3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
/*
1,2,3,4
5,6,7,8
9,10,11,12
*/
int a2[3][4] = { 1, 2, 3, 4, 5, 6 };
/*
1,2,3,4
5,6,0,0
0,0,0,0
*/
int a3[3][4] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, } };
/*
{1,2,3,0}
{4,5,6,0}
{7,8,0,0}
*/
for (int i = 0; i < 3; i++){
for (int j = 0; j < 4; j++){
scanf("%d",&a3[i][j]);
}
}
for (int i = 0; i < 3; i++){
for (int j = 0; j < 4; j++){
printf("%d", a3[i][j]);
putchar('\n');
}
}
//字符数组:char类型的数组
char c[6] = { 'a', 'b', 'c', 'd', 'e', 'f' };
for (int p = 0; p < 6; p++){
printf("%c\t", c[p]);
}
//字符串
char as[10] = "12346789\0";
scanf("%s", as);
printf("%s", as);
}
c--->数组
最新推荐文章于 2024-11-14 16:23:37 发布