Lesson 3 – Taking Input

In this lesson, use of a function, that is used for taking integer input, is explained.

Scanf is used to take input from the user. A placeholder is also used in printf OR scanf functions. A placeholder is like a blank space or an empty bowl, there are different placeholders for different data types. Some commonly used are:

  • %c – a character.
  • %s – a string.
  • %d – a decimal integer.
  • %o – octal integer.
  • %x – a hexadecimal integer.
  • %p – an address (pointer)
  • %f – for floats