我正在尝试向用户显示一系列问题,然后扫描响应。我的代码构建没有错误,但是当我运行它时出现错误:期望指向 char 的指针但找到指向聚合的指针。 这里有什么错误?
#include <stdio.h>
int main ()
{
char name[50] , lastname[50] , add[100], post[50], town[60], state[60], tel[50];
printf ("**** PLEASE ENTER THIS CONFIDENTIAL INFORMATION****");
printf ("\n=================================================\n=================================================");
printf ("\n\nFirst name:");
scanf ("%s",&name);
printf ("\nLast name:");
scanf ("%s",&lastname);
printf ("\nAddress Please:");
scanf ("%s",&add);
printf ("\nPostcode:");
scanf("%s",&post);
printf ("\ntown:");
scanf ("%s",&town);
printf("\nTelephone number:");
scanf("%s",&tel);
printf ("\n\n****CONFIDENTIAL INFORMATION****");
printf ("\n=================================================\n=================================================");
printf ("\nName:%s %s \n" ,name ,lastname);
printf ("Address:%s\n",add);
printf ("postal code:%s\n",post);
printf ("Town:%s\n",town);
printf ("State:%s\n",state);
printf ("Tel:%s\n",tel);
}