结构体里面的字符数组和字符指针该怎么赋值?
文章目录 1.C语言 结构体指针赋值 incompatible types when assigning to type 'char[20]' from type 'char *' 1.C语言 结构体指针赋值 incompatible types when assigning to type ‘char[20]’ from type ‘char *’ strcpy(pstudent->name, "guo zhao wei "); 为什么错误,该怎么写,(红色行) 追问 为什么不能直接赋值啊, 追答 用char nnnn [ 20 ] 定义的,用strcpy 用char * ppp定义的,用 = 来赋值 参考: C语言 结构体指针赋值 incompatible types when assigning to type 'char[20]' from type 'char *' https : // www . cnblogs . com / phpxuetang / p / 5978305. html 来源: CSDN 作者: 假如我年少有为不自卑~ 链接: https://blog.csdn.net/u011436427/article/details/104625228