You are here : Cstring.hstrcpy

strcpy() - string.h

The C library function char *strcpy(char *dest, const char *src) copies the string pointed to, by src to dest.


Syntax

char *strcpy(char *dest, const char *src)


Example

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

int main()
{
   char src[40];
   char dest[100];
  
   memset(dest, '\0', sizeof(dest));
   strcpy(src, "This is tutorialspoint.com");
   strcpy(dest, src);

   printf("Final copied string : %s\n", dest);
   
   return(0);
}


Output / Return Value

Final copied string : This is tutorialspoint.com


Limitations


Alternatives / See Also


Reference