The code below supposed to provide
str1 = ilikeyou.c
str2 = .com as str2 should not affect by strncat command
but it shows str1 = iloveyou.c and str2 = c
I wonder why str2 is only c when it supposed to be .com
Code:main () { char *str1 = "ilikeyou" char *str2 = ".com" clrscr (); printf ("your two lines are \n %s \n %s", str1,str2); strncat (str1,str2,2); printf ("\nYour new two lines are \n %s \n %s", str1,str2); getch (); return 0; }