Illustrates the difference between prefix mode and postfix mode. - C Operator

C examples for Operator:Increment Decrement Operator

Description

Illustrates the difference between prefix mode and postfix mode.

Demo Code

#include <stdio.h>

int main(void)
{
    int a, b;/*from  www  . jav  a 2s . c  o m*/
    
    a = b = 5;

    printf("\nPost  Pre");
    printf("\n%d    %d", a--, --b);
    printf("\n%d    %d", a--, --b);
    printf("\n%d    %d", a--, --b);
    printf("\n%d    %d", a--, --b);
    printf("\n%d    %d\n", a--, --b);

    return 0;
}

Result


Related Tutorials