This blog is under construction

Saturday, 28 April 2012

strcat example in C

 Header file:
    string.h

Synopsis:
     char *strcat(char *dest, char *src);

Description:
     It concatenates string src to the end of string dest and the concatenated string will be stored in dest.  Returns string dest on success.


strcat function C example:


  #include<stdio.h>
  #include<string.h>

  int main() {
        char to[100] = "virtual ", from[100] = "box";
        strcat(to, from);
        printf("Ouput: %s\n",to);
        return 0;
  }
 


  Output:
  jp@jp-VirtualBox:~/cpgms/chap5$ ./a.out
  Ouput: virtual box



 

No comments:

Post a Comment