Difference between using character pointers and character arrays

前端 未结 9 1128
不思量自难忘°
不思量自难忘° 2020-11-29 03:45

Basic question.

char new_str[]=\"\";

char * newstr;

If I have to concatenate some data into it or use string functions like strcat/substr/

9条回答
  •  再見小時候
    2020-11-29 04:04

    If you're in c++ why not use std::string for all your string needs? Especially anything dealing with concatenation. This will save you from a lot of problems.

提交回复
热议问题