Skip to content

Instantly share code, notes, and snippets.

@ustbgaofan
Created June 4, 2013 06:39
Show Gist options
  • Save ustbgaofan/5704010 to your computer and use it in GitHub Desktop.
Save ustbgaofan/5704010 to your computer and use it in GitHub Desktop.
指针 1)指针在本质上也是一个变量 2) 指针需要占用一定的内存空间 3) 指针用于保存内存地址的值 4)不同类型的指针占用的内存空间大小相同
#include <stdio.h>
int main()
{
int i;
int* pI;
char* pC;
float* pF;
pI=&i;
printf("%d,%d,%0X\n",sizeof(int *),sizeof(pI),&pI);
printf("%d,%d,%0X\n",sizeof(char *),sizeof(pC),&pC);
printf("%d,%d,%0X\n",sizeof(float *),sizeof(pF),&pF);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment