Integer format specifier : %d, %i Example program

C Programming Language Overview of C Language (Article) Overview of C Language (Program)

894

Program:

#include <stdio.h> 
int main() 
{ 
    int x = 45, y = 90; 
    printf("%d\n", x); 
    printf("%i\n", x); 
    return 0; 
} 

Output:

45
45

Explanation:

Integer Format Specifier %d

The %d format specifier is implemented for representing integer values. This is used with printf() function for printing the integer value stored in the variable.

Syntax:
printf("%d",<variable name>);

 


This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.