共用体中有int型和char[10]这两个成员,代码如下:
#include <stdio.h>
union st
{
int x;
char c[10];
}s;
int main(void)
{
s.x=50;
s.c="abcdef";
printf("%s",s.c);
return 0;
}
如果对s.c赋值一个字符串,VC 6.0编译器报错,error C2440: '=' : cannot convert from 'char [7]' to 'char [10]',
猛跑小猪
芜湖不芜
随时随地看视频慕课网APP