结构体中字符数组输入
有结构体:
struct word{ char a[26];}w[1000];rewind(stdin);if (1==scanf("%25s",w[0].a)) { printf("您输入的是[%s]\n",w[0].a);} else { print("输入错误!");}
[解决办法]
#include <stdio.h>
struct word
{
char a[26];
}w[1000];
int test_1()
{
scanf("%s", w[0].a);
int i;
printf("%s \n",w[0].a);
return 0;
}
运行结果:
输入
asdfas
输出
asdfas
所以你懂的..