C strcat( ) function

  • By using strcat() function, we can concatenate strings to another string.
  • Generally by using strcat(), source string data appending to destination string.
  • strcat() function required two arguments of type char* i.e. an address of a string.
  • When we are working with stract(), alwyas appending will take place at end of the destination string only.

Syntax:

char strcat(char* dest, const char* src);

Example:

#include
#include
#include
int main()
{
char s1[15]=”Welcome”;
char s2[12]=”to K2schools”;
clrscr();
puts(s1);
puts(s2);
strcat(s1,” “);
strcat(s1,s2);
puts(s1);
puts(s2);
getch();
return 0;
}

Powered by k2schools