(hello+world).c_str()
is only valid until the trailing ;
. Accessing the memory afterwards is undefined behavior.
Visual studio probably actually clears the memory, Dev-C++ doesn't bother. Try building a release version with Visual studio (optimizations on) and you'll probably see the same behavior.