可能是重复问题:
为什么字符数据的地址没有显示出来?
这里是代码和输出:
int main(int argc, char** argv) {
bool a;
bool b;
cout<<"Address of a:"<<&a<<endl;
cout<<"Address of b:"<<&b<<endl;
int c;
int d;
cout<<"Address of c:"<<&c<<endl;
cout<<"Address of d:"<<&d<<endl;
char e;
cout<<"Address of e:"<<&e<<endl;
return 0;
}
输出结果:
a的地址:0x28ac67
b的地址:0x28ac66
c的地址:0x28ac60
d的地址:0x28ac5c
e的地址:
我的问题是: 字符的内存地址在哪里?为什么没有打印出来?
谢谢。
printf
没有这个问题,因为它不会试图从参数类型推断正确的格式。 - dmckee --- ex-moderator kitten