STRNCPY() Function – C Program

STRNCPY() Function – C Program

Write a  C Program to Copy string to another string using STRNCPY string function.

STRNCPY() Function – The STRNCPY() function used to copy some portion of contains second string into first string.

The Syntax of STRNCPY() Function :

strcpy (str1, str2, 5) – It copies first 5 character of str2 into str1.
strcpy(str2, str1, 3) – It copies first 3 character of str1 into str2.

Example of STRCPY() Function C Program

The output of STRNCPY() Function C Program is :

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha *