C Program Of Strncpy() Function

C Program Of Strncpy() Function

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

main()
{

char str1[20];
strncpy(str1,"delu",2);

printf("%s\n",str1);    //if null character not inserted at the end
str1[2]='\0';
printf("%s\n",str1);     //if null character inserted at the end see the diff.


}

Related Posts