在网上查到的是说不论多少位机,内存地址指向的内存大小总是一个字节。但是在计算机科学导论的第 5 章中,图上面画的是指向两个字节。请问哪种是正确的呢?
刚才查了一下,字节(Byte)是电脑中表示信息含义的最小单位(注意:不是存储单位),所以我觉得第一种方法比较靠谱一点,,毕竟这本书里也不少。。
走同样的路,发现不同的人生
Yes, usually one byte. But who knows that some special machines (such as those mentioned in your data) have some weird ways.
Test the code.int a = 0x7F << 8;int size = sizeof(a);char p = (char )&a;printf("%p",&p[0]);//First addressprintf("%p",&p[1]);//Second address
char t = p[1];printf("%d",t); //If 127 is printed, it means one byte
Yes, usually one byte. But who knows that some special machines (such as those mentioned in your data) have some weird ways.
Test the code.
int a = 0x7F << 8;
int size = sizeof(a);
char p = (char )&a;
printf("%p",&p[0]);//First address
printf("%p",&p[1]);//Second address
char t = p[1];
printf("%d",t); //If 127 is printed, it means one byte