Memory access violation. What's wrong with this seemingly simple program?

前端 未结 7 1656
清歌不尽
清歌不尽 2021-01-20 21:50

This is a quick program I just wrote up to see if I even remembered how to start a c++ program from scratch. It\'s just reversing a string (in place), and looks generally c

7条回答
  •  醉酒成梦
    2021-01-20 22:00

    If this isn't homework, the C++ tag demands you do this by using the C++ standard library:

    std::string s("This is easier.");
    std::reverse(s.begin(), s.end());
    

    Oh, and it's int main(), always int main(), dammit!

提交回复
热议问题