Why do you prefer char* instead of string, in C++?

后端 未结 12 1200
北海茫月
北海茫月 2021-02-01 08:31

I\'m a C programmer trying to write c++ code. I heard string in C++ was better than char* in terms of security, performance, etc, however sometimes it

12条回答
  •  南笙
    南笙 (楼主)
    2021-02-01 08:52

    Short answer, I don't. The exception is when I'm using third party libraries that require them. In those cases I try to stick to std::string::c_str().

提交回复
热议问题