<分区>
请看这段代码。
#include <iostream>
#include <string>
using namespace std;
int main() {
string hello = "Hello"
, world = "World";
const char *p = (hello+world).c_str();
cout << "STRING: " << p <<endl;
return 0;
}
我没有声誉,无法发布图片,因此我将手写结果。
= Visual Studio 2013 ver.12.0.30110.00
STRING:
= Dev-C++ ver.4.9.9.2
STRING: HelloWorld
下面首先是Visual Studio编译后的执行结果。
其次是用Dev-C++编译的。
我想知道是什么造成了这种差异。
期待您的回复。谢谢:)