Skip to content

Instantly share code, notes, and snippets.

@HaiyangXu
Created May 28, 2014 08:54
Show Gist options
  • Save HaiyangXu/db0ce47b85426315080c to your computer and use it in GitHub Desktop.
Save HaiyangXu/db0ce47b85426315080c to your computer and use it in GitHub Desktop.
Test pointer address
#include<cstdio>
int main()
{
int a[5]={1,2,3,4,5};
printf("sizeof(&a):%d\tsizeof(a)%d\n",sizeof(&a),sizeof(a));
int *ptr=(int *)(&a+1);
printf("a=%d,&a=%d,a+1=%d,&a+1=%d\n",a,&a,a+1,&a+1);
printf("%d,%d",*(a+1),*(ptr-1));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment