strcat( ) function is C built in string function which is basically used to join two or more than string together.
![]() |
| strcat() in C |
In this article we will learn about string function, strcat( ) in detail in which we will discuss following topics...
- strcat function in c
- strcat function in c example
- strcat function in c syntax
- header file for strcat function in c
strcat( ) function in C
strcat( ) function is also known as a built in function or standard library function of C and it widely know as string function. strcat( ) function is basically used to joined two more string together in C program.
i.e. string1 and string2 are two strings and if you want to join these two string then we use strcat( ) and than this function remove null character from string1 at the end after this string2 is append to string1.
The size of string(in which want to add) must be greater than other string.
Header file for strcat( ) function in C
strcat( ) function is a built in function of C and it is define in <string.h> header file.
strcat( ) function in C syntax
strcat( str1 , str2);
Note: if you want to add string2 with string1 than string1 is in left side and string2 is in right side in bracket but if you want to add string1 with string2 than put the string2 in left side and string1 is in right side.
i.e.
string1[20]="akash";
string2[10]="pandey";
Now if you are write like this strcat(string1,string2) the output will be akashpandey, but if you are write like this strcat(string2,string1) then its output will be pandeyakash.
strcat( ) function in C example
#include<stdio.h>
#include<string.h>
int main()
{
char str[15]="Akash";
char str1[7]="Pandey";
strcat(str,str1);
printf("%s",str);
return 0;
}
____________________________________
____________________________________
Conclusion:-
strcat( ) function is basically used to join two string together.

