Struct与Char*转换问题

来源:互联网 发布:bilibili是什么软件 编辑:程序博客网 时间:2024/06/05 11:20
struct s
       {
              int id;
              char name[4];
       };
       char* t = (char*)s;
       strcpy((char *)&s,t);
       Struct与Char*之间可以相互转换,但是要注意内存对齐的问题。
       对齐的简单办法,使用wsprintf();
原创粉丝点击