[問題] 想請高手解惑一段很短的程式
#include<stdio.h>
#include<stdlib.h>
int main()
{
union tt
{
unsigned short a;
unsigned short b[2];
unsigned short c;
}A;
A.a=10;
A.c=20;
printf("%d",A.a);
system("PAUSE");
return 0;
}
出來之後的A.a是20但是不太清楚為什麼
還有sizeof(tt)是4
請高手解惑
小弟觀念真的還不夠深 ORZ
謝謝
--
這年頭沒真相沒得混 ORZ.....
http://ppt.cc/S!iF
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.45.246.75
→
07/17 17:28, , 1F
07/17 17:28, 1F
推
07/17 17:32, , 2F
07/17 17:32, 2F
→
07/17 17:33, , 3F
07/17 17:33, 3F
→
09/14 16:11, , 4F
09/14 16:11, 4F