|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include<stdio.h>
int main()
{
typedef struct{
char name[20];
int number;
struct {int year;int mouth ;int day;}date;
}Book;
Book book;
Book *pbook = &book;
book.name[20] = {c,p,r,o,g,r,a,m} ;
printf("%c\n",book.name);
}
//11 18 A:\学习资料\代码\未命名1.c [Error] expected expression before '{' token
- #include<stdio.h>
- int main()
- {
- typedef struct{
- char name[20];
- int number;
- struct {int year;int mouth ;int day;}date;
- }Book;
- Book book;
- Book *pbook = &book;
- book.name[20] = {'c','p','r','o','g','r','a','m'}; // 错在这
- printf("%c\n",book.name);
- return 0;
- }
复制代码
数组赋值你就错了 而且 字符的话要单引号 而且
你应该加个 for 循环来赋值的
|
|