What is the function of strcat function?

coldplay.xixi
Release: 2020-07-24 15:30:30
Original
9022 people have browsed it

The function of strcat function is to connect two char types, the code is [char d[20]="Golden";char s[20]="View";strcat(d,s);] where The memory areas pointed to by d and s cannot overlap and d must have enough space to accommodate the string of s.

What is the function of strcat function?

The function of strcat function is to connect two char types.

For example:

char d[20]="Golden";
char s[20]="View";
strcat(d,s);
//打印d
printf("%s",d);
Copy after login

The output

 d
Copy after login

is GoldenView (no space in the middle)

The memory areas pointed by d and s cannot overlap and d must have enough space to hold s's string.

Return the pointer to d.

What is the function of strcat function?

Extended information

In C, the function prototype exists in the header file.

In C, it exists in the header file.

Copy the string pointed to by src (including "\0") to the end of the string pointed to by dest (delete the "\0" at the original end of *dest). Make sure *dest is long enough to accommodate the copied *src. The original characters in *src remain unchanged. Returns a pointer to dest.

Note: The memory areas pointed to by src and dest cannot overlap and dest must have enough space to accommodate the string of src.

Related learning recommendations: C video tutorial

The above is the detailed content of What is the function of strcat function?. 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