首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

[hello world]菜鸟问个char *的有关问题

2012-09-09 
[hello world]初学者问个char *的问题C/C++ codeint index 0string s1 hello world string *_ &

[hello world]初学者问个char *的问题

C/C++ code
  int index = 0;       string s1 = "hello world" ;       string *_ = &s1;       char *s1p = &(s1[index]);      cout << _ << endl;      cout << s1p <<endl;      cout << *( s1p+1) << endl;//输出     0x22ff40     hello world     e

dev c++ 5上编的
第二个为甚么是hello world呢


[解决办法]
就是这么定义的

cout一个char*,就输出该地址其实的c风格字符串
[解决办法]
要输出地址,就cout << (void*)s1p <<endl;

热点排行