c语言,结构体中的字符数组。

[复制链接]
查看11 | 回复1 | 2011-7-21 12:33:17 | 显示全部楼层 |阅读模式
结构体问题
struct personal
         {
                 char name[20] ;
                 struct date
                 {
                         int year ;
               
int month;
               
int day;
                 }birthday;
                 char adress[20];
         };
         struct personala;

a.name="liming";
         a.birthday.year=1992;
         a.birthday.month=5;
         a.birthday.day=16;
         a.adress="hubei";
显示出错, error C2440: '=' : cannot convert from 'char [6]' to 'char [20]'

There is no context in which this conversion is possible,
就是这两个字符数组的赋值问题,我查过很多,也改过好多遍就是对不了。求大虾指点。

回复

使用道具 举报

千问 | 2011-7-21 12:33:17 | 显示全部楼层
程序的其余部分那这部分程序是在主函数外的吗;你详细点...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行