(C/C++) 32bit 64bit 記憶體空間

Posted ollie-lin

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了(C/C++) 32bit 64bit 記憶體空間相关的知识,希望对你有一定的参考价值。

char str[] = "Hello" ;
char *p = str ;
printf("sizeof(str) = %d\n", sizeof(str));
printf("sizeof(p) = %d\n", sizeof(p));
printf("sizeof(short) = %d\n", sizeof(short));
printf("sizeof(int) = %d\n", sizeof(int));
printf("sizeof(long) = %d\n", sizeof(long));
printf("sizeof(long long) = %d\n\n", sizeof(long long));
printf("sizeof(size_t) = %d\n", sizeof(size_t));
printf("sizeof(double) = %d\n", sizeof(double));
printf("sizeof(long double) = %d\n", sizeof(long double));

64 bit :

sizeof(str)       = 6
sizeof(p)         = 8
sizeof(short)     = 2
sizeof(int)       = 4
sizeof(long)      = 8
sizeof(long long) = 8
sizeof(size_t)    = 8
sizeof(double)    = 8
sizeof(long double) = 16

32 bit :

sizeof(str)       = 6
sizeof(p)         = 4
sizeof(short)     = 2
sizeof(int)       = 4
sizeof(long)      = 4      
sizeof(long long) = 8
sizeof(size_t)    = 4
sizeof(double)    = 8
sizeof(long double) = 12

 

以上是关于(C/C++) 32bit 64bit 記憶體空間的主要内容,如果未能解决你的问题,请参考以下文章

[FPGA][DE0] Qsys 加入 FLASH 記憶體 方法及步驟

Linux 用 ps 與 top 指令找出最耗費 CPU 與記憶體資源的程式最占cpu的进程

32bit和64bit有啥区别?

32-bit系统与64-bit系统的区别

操作系统 32bit 和 64bit 有啥区别

32 bit 与 64 bit 程序比较