0
Why does this part always gets skipped? Please help.
I've been told that it's because of the newline and I should remove it but I'm not sure how to do it. This is the part where it jumps to the next fgets: printf("Enter first string: "); fgets (first_name, 100, stdin); printf("\n"); Code: https://code.sololearn.com/cLlmpbjn4kf9 *It's a long switch case, I'm using Dev C++
5 Respuestas
+ 2
That's because strcat() is concatenating str1 and str2 and assigning the new concatenated string to str1. str2 is left unchanged. You then print the new str1 and then the unchanged str2 in lines 59 and 61.
fflush() is fine to use too.
str1 = first_name
str2 = second_name
+ 1
Try adding a space after %d in your scanf to catch the trailing whitespace character '\n'
scanf("%d ", &string_library);
+ 1
Also change line 13 to;
printf("Choose the String Function to demo: ");
and line 59 to;
printf("str1 = %s", first_name);
This should get rid of the remaining warnings.
+ 1
ChaoticDawg
in line 56, I need both the first name and second name to print together but instead, the second name prints after str1 in devc++
also the fflush works too
0
I printed a new str1 but it still prints like this
str1 = Mike
Santos