深刻解析C++ Data Member內存結構。本站提示廣大學習愛好者:(深刻解析C++ Data Member內存結構)文章只能為提供參考,不一定能成為您想要的結果。以下是深刻解析C++ Data Member內存結構正文
代碼以下所示:
#include <stdio.h>
int main(int argc, char *argv[])
{
int a[2];
unsigned int add1 = &a[0];
unsigned int add2 = &a[1];
printf("The address of a[0] is %u/n",add1);
printf("The address of a[1] is %u/n",add2);
printf("The size of int is %u/n", add2 - add1);
}
輸入成果是:
The address of a[0] is 3218821936
The address of a[1] is 3218821940
The size of int is 4