【发布时间】:2015-07-26 05:47:09
【问题描述】:
在输入字符串时,我收到类似
的警告error: format '%s' expects argument of type 'char *', but argument 2 has type 'char (*)[10]'
在应用中
#include<stdio.h>
int main(void)
{
char a[100][10];
int s,i,k=0;
scanf("%d",&s);
for(i=0;i<s;i++)
{
scanf("%s",&a[i]);
}
}
【问题讨论】:
-
记住这一点:每当您通过
scanf扫描%s时,不要使用带有变量名的&。