变量也疯狂!!!!!!!!!
#include <iostream>#include <cstdio>
using namespace std;
int main()
{
int a=1,b=2,c=3,d=4,e=5,f,*g,*h;
cout<<"正常的"<<endl;
h=&a;
cout<<"a="<<*h<<endl;
h=&b;
cout<<"b="<<*h<<endl;
h=&c;
cout<<"c="<<*h<<endl;
h=&d;
cout<<"d="<<*h<<endl;
h=&e;
cout<<"e="<<*h<<endl;
cout<<"****************************************"<<endl;
cout<<"无语的变量"<<endl;
cout<<"a="<<*(&f+5)<<endl;
cout<<"b="<<*(&f+4)<<endl;
cout<<"c="<<*(&f+3)<<endl;
cout<<"d="<<*(&f+2)<<endl;
cout<<"e="<<*(&f+1)<<endl;
cout<<"*****************************************"<<endl;
cout<<"无语的指针"<<endl;
printf("a=%-d\nb=%-d\nc=%-d\nd=%-d\ne=%-d\n",*(&g+6),*(&g+5),*(&g+4),*(&g+3),*(&g+2));
return 0;
}
/* 知道了变量的声明就。。。。。。。。。。。。无语啊
变量先声明先分配,分配地址从高到低,数组先低再高
一点心得,*/