typedef unsigned char byte;
unsigned int nines = 999;
byte * ptr = (byte *) &nines;
printf ("%x\n",nines);
printf ("%x\n",nines * 0x10);
printf ("%d\n",ptr[0]);
printf ("%d\n",ptr[1]);
printf ("%d\n",ptr[2]);
printf ("%d\n",ptr[3]);
3e7
3e70
231
3
0
0
私は、最初の2つは999と999 * 16のちょうど進数表現であることを知っています。残りの4はどういう意味ですか? ptr [0]〜ptr [3]?
16進数で 'ptr'の値も印刷してみてください。 –
ほとんどの場合、ビッグエンディアンマシンではなく、リトルエンディアンマシンを使用していることを意味します。おそらくインテルのマシンですが、必ずしもそうではありません。 –
https://en.wikipedia.org/wiki/Endianness – Havenard