What is the string concatenation function in C language?

王林
Release: 2020-07-17 10:06:40
Original
14845 people have browsed it

The string connection function in C language is: strcat(). This function will append the specified string to the end of the destination string, so you must ensure that the destination string has enough memory space to accommodate the two strings, otherwise an overflow error will occur.

What is the string concatenation function in C language?

The string concatenation function in C language is strcat(), which is used to concatenate (splice) two strings.

(Recommended tutorial: C Language Tutorial)

Function syntax:

char*strcat(char* strDestination, const char* strSource);
Copy after login

Parameter description:

  • strDestination: Destination string

  • strSource: Source string

strcat() function appends the string pointed to by strSource to the string pointed by strDestination. The end of the string pointed to, so you must ensure that strDestination has enough memory space to accommodate the two strings, otherwise an overflow error will occur.

Note: The \0 at the end of strDestination will be overwritten, the \0 at the end of strSource will be copied together, and the final string will only have one \0.

Return value: Pointer to strDestination.

Code:

What is the string concatenation function in C language?

The above is the detailed content of What is the string concatenation function in C language?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template