Pointer to const char vs char array vs std::string

前端 未结 7 2020
不思量自难忘°
不思量自难忘° 2020-12-16 20:48

Here I\'ve two lines of code

const char * s1 = \"test\";
char s2 [] = \"test\";

Both lines of code have the same behavior, so I cannot see

相关标签:
7条回答
  • 2020-12-16 21:29

    Use std::string unless you know why you need a char array / pointer to char.

    0 讨论(0)
提交回复
热议问题