Tra*_*d97 0 c++ string char
#include <iostream> #include <string.h> using namespace std; int main() { char x[100]="hello"; int s=strlen(x); cout<<&(x[0]); }
如果我编译并运行它,
输出是你好的
为什么输出不是字符'h'的地址?
Bau*_*gen 10
因为operator <<重载是const char*为了打印由零指向的零终止的C字符串const char*.
operator <<
const char*
归档时间:
11 年,5 月 前
查看次数:
115 次
最近记录: