结构题赋值问题,谢谢啊
main()
{
struct stu
{
int num;
char *name;
char sex;
float score;
} boy1,boy2;
boy1.num=102;
boy1.name="Zhang ping";/这语句对不对啊/还是 strcpy(boy1.name,"Zhang Ping);
printf("input sex and score\n");
scanf("%c %f",&boy1.sex,&boy1.score);
boy2=boy1;
printf("Number=%d\nName=%s\n",boy2.num,boy2.name);
printf("Sex=%c\nScore=%f\n",boy2.sex,boy2.score);
}
[此贴子已经被作者于2006-10-2 21:07:43编辑过]