int _tmain(int argc, _TCHAR* argv[])
{
char string1[20], append_string[40];
char *string2 = "APPENDED"; /* string to be appended */
/* prompt for string 1 */
printf("Enter string1: ");
scanf_s("%s", &string1);
while (!strcmp(string1, "done") == 0)
{
printf("Before append. \nString1: %s \nString2: %s\n\n", string1, string2);
mystrappend(string1, string2, append_string);
printf("After append. \nString1: %s \nString2: %s \nAppended string: %s\n\n", string1, string2, append_string);
// prompt for string 1
printf("Enter string1: ");
scanf_s("%s", &string1);
}
return 0;
}
Why doesn't String1
store anything after input?
I have the header files of stdio.h
, conio.h
, string.h
and stdafx.h
included.