为什么字符型变量的地址不能用cout输出啊?
我输出整型变量的地址是OK的,但是输出字符型变量的地址时
就不正确。程序如下:
#include <iostream.h>
#include <stdio.h>
int main()
{
int i = 1024;
//int *pi = &i;
char ch = 'a';
cout<<"i:"<<i
<<"\t&i:\t"<<ch<<endl;
cout<<"the address of a is:"<<&ch<<endl;
system("Pause");
}
将&ch用(int)强制转换符就OK了,但是用static_cast<int>就不行
哪位大侠告诉一下原因啊?!!