printf() sends data to the screen. The
scanf() function gets data from the keyboard. You must have a way to get data from your user. You can’t always assign data values using assignment statements. For example, if you were writing a movie theater program for use throughout the country, you couldn’t assign the cost of a ticket to a variable using the equals sign in your program because every theater’s ticket price could differ. Instead, you would have to ask the user of the program in each theater location how much a ticket costs before computing a charge.
At first glance, the
scanf() function might seem confusing, but it is ...