Question: Using C, When scanf encounters an error, the invalid data are left in the input stream, sometimes making it impossible to continue. Write a program

Using C, When scanf encounters an error, the invalid data are left in the input stream, sometimes making it impossible to continue. Write a program that reads three pieces of numeric data. If an error is detected (return value not EOF but less than 3), flush the erroneous data. Then test the function by entering numeric data and alphabetical data in different sequences. Post your program, as well as your test input and output.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!