Part of the code is as follows but not work
printf("Enter a line of text (Enter to stop): ");
fflush(stdin);
fgets(input, 256, stdin);
if (input == '\0') {
exit(0);
}
.....
.....
i want if the user only press enter, the program will be terminated. how to do it?
thanks
Use
if(*input == '\n')– iffgetsreads a newline, it’s stored in the buffer.