C语言中,如何正确打印字符串数组?
发布网友
发布时间:2023-09-01 00:14
我来回答
共1个回答
热心网友
时间:2024-02-04 08:22
试一试这种方式:
char name[10][100] = {};
int ictr;
for(ictr = 1; ictr<=10; ictr++)
{
printf("\nNumber %d name is:", ictr);
scanf("%s", name[ictr - 1]);
}
printf("Names:");
for(ictr = 0; ictr < 10; ictr++)
{
printf("%s\n", name[ictr]);
}