strcpy function : string.h >> Copy second string into First



strcpy function : string.h :Copy second string into First
What strcmp Actually Does ?

  1. Function takes two Strings as parameter
  2. Header File : String.h
  3. It returns string
  4. Perpose : Copies String2 into String1
  5. Original contents of String1 will be lost
  6. Original contents of String2 will remains as it is ….

Syntax :

char * strcpy ( char *string1, char *string2 ) ;

Return Type

Return Type String
Parameters Two Strings

Live Example 1

char s1[10] = "SAM" ;
char s2[10] = "MIKE" ;
strcpy (s1,s2);
puts (s1) ; // Prints : MIKE
puts (s2) ; // Prints : MIKE