C++ Program to Concatenate Two Strings
source link: https://www.geeksforgeeks.org/videos/c-program-to-concatenate-two-strings/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
C++ Program to Concatenate Two Strings
- 30 Views
- 03/06/2022
In this video we will see a program to concatenate two strings in C++ using different approaches:
1) Concatenate two strings using the + operator 2) Concatenate two strings using the append() function 3) Concatenate two strings using the strcat() function
This is the easiest method for the concatenation of two strings.The ‘+’ operator simply adds the two strings and returns a concatenated string.
The append function appends the add(variable) string at the end of the init string.
The strcat() function is defined in the “string.h” header file, and this function is also used for concatenating two strings.
The basis syntax of strcat() is as follows: Syntax: char * strcat(char * init, const char * add)
Here the init and add string should be of character array(char*). This function concatenates the added string to the end of the init string.
Concatenate 2 Strings: https://www.geeksforgeeks.org/methods-to-concatenate-string-in-c-c-with-examples/
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK