STRNCPY() Function – C Program

In previous C Language Program post we had discussed about Calculate Length of String and Reverse String and Concatenate String and Compare String and STRCAM Function and STRCAT Function and STRLEN Function and STRCPY Function and STRNCAT Function.

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 *

1 + 5 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">