[hello world]菜鸟问个char *的有关问题
[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;