||Run Listing 4.1 again, but this time give your first and last name when it asks you for your first name. What happens? Why?|
||The program malfunctions. The first scanf() statement reads just your first name, leaving your last name untouched but still stored in the input “buffer.” (This buffer is just a temporary storage area used to store the input.) When the next scanf() statement comes along looking for your weight, it picks up where the last reading attempt ended, and tries to read your last name as your weight. This frustrates scanf(). On the other hand, if you respond to the name request with something like Lasha 144, it uses 144 as your weight, even though you typed it before your weight was requested.|
||Assuming that each ...|
Get C Primer Plus, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.