This blog is under construction

Saturday 28 April 2012

strcpy example in C

 Header file:
    string.h

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

Description:
     It copies string src to string dest along with '\0'.  Returns the string dest on success.


strcpy function C example:


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

  int main() {
        char data1[100];
        strcpy(data1, "Hello world");
        printf("Output:%s\n", data1);
        return 0;
  }



  Output:
  jp@jp-VirtualBox:~/cpgms/chap5$ ./a.out
  Output:Hello world


No comments:

Post a Comment