#include <stdio.h>
int main(void) {
char str[50];
printf("Enter a string : ");
gets(str);
printf("You entered: %s", str);
return(0);
}
I am running the code on Eclipse, I expected to get the following result:
Enter a string : abcde
You entered: abcde
but when I run the program, the first print statement does not show up in the console, and after I type in any string, the program fails. Can anyone tell me why this happened? Also, can you tell me how to fix my code to get the expected result?