Have to take a input string of size 5. Also have to check for validity in some unrelated sense. If the input is not valid user is prompted to input again.
Using the scanf("%4s", input);
But if the user inputs suppose string of 8 characters, the scanf just scans the last 4 chars still in the buffer before asking for actual user input.
I tried making a buffer variable that stores the input before passing it to the target var.
scanf()leaves the newline character in the buffer.