C Programming - Handling string input when the program requires an int

Опубликовано: 20 Октябрь 2024
на канале: Painless Programming
20,260
337

Strategies for handling scanf statements that require and int %d when the user types in characters. Use the result of scanf to determine if an int was read in. If it was not, exit or read past the character input and let the user try again.