指针变量占据字节大小

Run Settings
LanguageC
Language Version
Run Command
#include <stdio.h> int main() { int Inum = 0; short Snum = 0; double Dnum = 0; int *pInt = &Inum; short *pShort = &Snum; double *pDouble = &Dnum; printf("int 类型变量占用字节数 %zd\n", sizeof(Inum)); printf("short 类型变量占用字节数 %zd\n", sizeof(Snum)); printf("double 类型变量占用字节数 %zd\n\n", sizeof(Dnum)); printf("int 类型指针变量占用字节数 %zd\n", sizeof(pInt)); printf("short 类型指针变量占用字节数 %zd\n", sizeof(pShort)); printf("double 类型指针变量占用字节数 %zd\n", sizeof(pDouble)); // 指针变量 // 32位系统 占用 4个字节 // 64位系统 占用 8个字节 }
Editor Settings
Theme
Key bindings
Full width
Lines