Why use c strings in c++?

后端 未结 18 2151
终归单人心
终归单人心 2021-02-07 04:12

Is there any good reason to use C-strings in C++ nowadays? My textbook uses them in examples at some points, and I really feel like it would be easier just to use a std::string

18条回答
  •  梦如初夏
    2021-02-07 04:46

    For applications such as most embedded platforms where you do not have the luxury of a heap to store the strings being manipulated, and where deterministic preallocation of string buffers is required.

提交回复
热议问题