C- strncat()
function: The
general format of strncat() function is:
Syntax: strncat(targetstring
, sourcestring, n);
Where, n is
an integer argument. Function appends
atmost n characters of source string to target string.
/* EXAMPLE PROGRAM */
#include<string.h>
main()
{
char
str1[50],str2[50];
clrscr();
printf("\nEnter
string 1:");
gets(str1);
printf("\nEnter
string 2:");
gets(str2);
strncat(str1,str2,3);
printf("\nSTRING
1:");
puts(str1);
printf("\nSTRING
2:");
puts(str2);
}
No comments:
Post a Comment