Skip to main content
Logo image

Section 11.2 Understanding scanf()

Next, let’s understand the scanf() function in more detail.
Figure 11.2.

Check Your Understanding Check Your Understanding

1.

    What is the correct way to have the user input an integer and store it in the variable age?
    Feel free to use the window below to try out some commands.

    admin.....open in new window

  • scanf("%d", &age);
  • Correct
  • scanf("%d", age);
  • Not quite. Try again!
  • scanf("%age", &d);
  • Not quite. Try again!
  • scanf("&age");
  • Not quite. Try again!