I am implementing a program which has check my input for length and if it is over 80 characters it needs to output an error saying that the input is over 80 characters, and if there is no input (if only enter is pressed at the prompt) it needs to simply end the program with no output.
this is why I did not limit my array size, but I checked if the input is over 80 characters big and in that case output an error and end the program, and in a case of size 0 I only end the program.
but I have a problem with array overrun.
I got a suggestion to use fgets over gets to deal with it.
But I am not sure how to implement fgets to read input from the keyboard.
As well as that, from how I understood the function fgets , it returns NULL if there is no input (only 'enter') or on any other error (which includes the case if the input is over 80 characters).
is there any other way I can implement my error checking?