C++中cout输出字符型指针地址值的方法
转载:http://blog.csdn.net/u013467442/article/details/43666955
#include<iostream> #include<string> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { char c[3]={'a','b','c'}; char *p=c; cout<<*p<<' '<<(void*)p<<endl; cout<<*(p+1)<<' '<<static_cast<void*>(p+1)<<endl; cout<<*(p+2)<<' '<<static_cast<void*>(p+2)<<endl; system("pause"); return 0; }