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

后端 未结 12 1182
北海茫月
北海茫月 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:56

    Compare and contrast the following C and C++ examples:

    strlen(infinitelengthstring)
    

    versus

    string.length()
    

提交回复
热议问题