小编use*_*016的帖子

结合内部的结构

int main()
{
  union {
    struct {
      char c[2];
      char ch[2]; 
    } s;
    struct {
       int i;
       int j; 
    } st;
  } u = { (12, 1), (15, 1) };

  printf("%d %d ", u.st.i, u.st.j);
}
Run Code Online (Sandbox Code Playgroud)

为什么上面打印"257 0"?

使用{}而不是()?创建了什么区别?

c struct unions

14
推荐指数
2
解决办法
2794
查看次数

标签 统计

c ×1

struct ×1

unions ×1