指针与数组名

来源:互联网 发布:数据保密承诺书 编辑:程序博客网 时间:2024/04/20 01:00

struct student
{
long num;
char name[10];
float score;
};

stu.name = "alex";

报错:

error: incompatible types when assigning to type ‘char[10]’ from type ‘char *’


修改:strcpy(stu.name, "alex");

原创粉丝点击