How to concatenate string arrays in c++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to concatenate string arrays in c++?

12th Oct 2017, 4:39 PM
ayush
ayush - avatar
5 Answers
+ 3
with the operator + for example string new = "hey " + "you!";
12th Oct 2017, 4:41 PM
‎ɐısıօլɐ
‎ɐısıօլɐ - avatar
+ 6
@Rajesh k Yadav Sure! What do you need to know? PS - Can you make a seperate thread for that? We shouldn't post things here that are unrelated to the original thread.
12th Oct 2017, 5:11 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 3
Basic C-strings (Null Terminated character arrays) were concatenated using the strcat() function. It cannot be used with std::string, though you may append an std::string to a char array using strcat like this: char str[20]="Hello World"; std::string str2 = "!."; strcat(str,str2.c_str()); // str becomes -> Hello World!. Also, std::strings can be concatenated with the + or += operators, or using an append() method, which can even receive char arrays as input. So that makes a total of 4 types of functions that are available in general in C++ for concatenation of strings, in general...
12th Oct 2017, 4:58 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
0
yes...but how many other ways are possible?
12th Oct 2017, 4:43 PM
ayush
ayush - avatar
0
Anyone here who help me to know array I'm really tired to know array
12th Oct 2017, 5:09 PM
Rajesh k Yadav