Format Specifiers in C Program



 Format Specifiers in C Program

Learn c - c tutorial - Format Specifiers in C Program - c examples - c programs

Format Specifiers in C Program

  • Operators are used in printf () function for the data that is referred by any object and any variable is called as Format specifiers.
  • When a value is stored in a particular variable then you cannot print the value stored in the variable straight forwardly without using the format specifiers.

Difference Between %d and %i Format Specifier in C Program:

  • %d : %d integer format specifier
  • %i : %i signed integer short unsigned short int long

Sample Code

#include <stdio.h>
int main()
{
    int a=6734;
    printf("value of \"a\" using %%d is= %d\n",a);
    printf("value of \"a\" using %%i is= %i\n",a);
    return 0;
}

Output

value of "a" using %d is= 6734
value of "a" using %i is= 6734


View More Quick Examples


Related Searches to Format Specifiers in C Program