Thursday, 12 January 2012

Strcat Function

#include <stdio.h>
char *strcat(char *dest, const char *src); 
The strcat function concatenates or appends src to dest. All characters from src are copied including the terminating null character.
Return Value
The strcat function returns dest.
#include <stdio.h>
int main() 
  char string1[20];
  char string2[20];
  strcpy(string1, "Hello");
  strcpy(string2, "Hellooo");
  printf("Returned String : %s\n", strcat( string1, string2 ));
  printf("Concatenated String : %s\n", string1 );
  return 0;
It will proiduce following result:
Returned String : HelloHellooo
Concatenated String : HelloHellooo

No comments:

Post a Comment

host gator coupon