Getting Started With C

Formatted Input

            Format Code	      Description
              %d	          Integer
              %f	          Float
              %lf	          Double
              %c	          Character
              %s	          String
              %x	          Hexadecimal
              %o	          Octal

Here's an example program that demonstrates the use of these format codes:

Program.c


In this program, we use scanf to read different types of inputs from the user using the format codes mentioned in the table.

Resources :

Featured
Special title treatment

With supporting text below as a natural lead-in to additional content.

Q1. What is the purpose of the format string in formatted input functions?

Q2. Which format specifier is used to input a single character in C?