C strcpy

C Copying String

This string is used to copy the contents of one string into another. strcpy() function copies source string in destination. The base addresses of the source and target strings should be supplied to this function.

Syntax for strcpy():



strcpy() copy character into destination string till it doesn’t encounter the end of source string (‘\0’).It is necessary that destination string is big enough to hold the string is copied into it.

C strncpy()

This strncpy() function is used to copy some portion of one string into another string. Copies a given number of characters from destination string to source string.

Syntax for strncpy()



Help others by sharing the content!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.