Postfix operator vs prefix operator - C Operator

C examples for Operator:Increment Decrement Operator

Description

Postfix operator vs prefix operator

Demo Code

#include <stdio.h>
int main(void)
{
    int a = 1, b = 1;
    int a_post, pre_b;
    /* w w w .j av a2 s.c  o m*/
    a_post = a++;  // value of a++ during assignment phase
    pre_b = ++b;   // value of ++b during assignment phase
    printf("a  a_post   b   pre_b \n");
    printf("%1d %5d %5d %5d\n", a, a_post, b, pre_b);
    
    return 0;
}

Result


Related Tutorials