C Language

May 21, 2023

Postfix increment decrement in C Language

Program use increment decrement in C Language


#include <stdio.h>
int main()
{
    int x = 8;
    printf("x=%d\t", x);
    printf("x=%d\t", x++);
    printf("x=%d\t", x);
    printf("x=%d\n", x--);
    printf("x=%d\n", x);
    return 0;
}

output


x=8  x=8  x=9  x=9  x=8  

  1. Declare integer variable x = 8
  2. Initialize in integer variable x = 8
  3. printf inbuild function to display value of variable x in decimal place holder %d x = 8 for formatting tab separator \t is used
  4. printf inbuild function to display postfix increment values variable x in decimal place holder %d x = 8 for formatting tab separator \t is used
  5. printf inbuild function to display value of variable x int decimal place holder %d x = 9 for formatting tab separator \t is used
  6. printf inbuild function to display post decrement values variable x in decimal place holder %d x = 9 for formatting tab separator \t is used
  7. printf inbuild function to display value of variable x in decimal place holder %d x = 8 for formatting tab separator \t is used

    by : Nadeem Khan

    Quick Summary:

    Postfix increment /Decrement