/** * 功能:内存存放地址的地方 * 时间:2014年8月10日11:01:08 * 作者:cutter_point */ #include<iostream> using namespace std; //全局变量的存放地点 int dog, cat, bird, fish; //函数存放内存地点 void f(int pet) { cout<<"pet id number: "<<pet<<endl; } int main() { int l, i, j, k; //依次输出地址位置 cout<<"--------------------------------全局int----------------------------------"<<endl; // kk: cout<<"\n int dog:"<<(long)&dog <<"\n int cat:"<<(long)&cat <<"\n int bird:"<<(long)&bird <<"\n int fish:"<<(long)&fish<<endl; cout<<"--------------------------------函数----------------------------------"<<endl; cout<<"\n void f():"<<(long)&f<<endl; // goto kk; 这样果断死循环了 cout<<"--------------------------------局部int----------------------------------"<<endl; cout<<"\n int i:"<<(long)&i <<"\n int j:"<<(long)&j <<"\n int k:"<<(long)&k<<endl; // cout<<"\n l:"<<(int)&l; return 0; }
【ThinkingInC++】6、内存存放地址的地方,布布扣,bubuko.com
原文地址:http://blog.csdn.net/cutter_point/article/details/38468239