// program to demonstrate working of unary increment and decrement operators
#include <stdio.h>
void main()
{
int a = 1;
printf("a value: %d",a); // 1
int b = a++; // post increment
printf("b value after a++ : %d",b); // b=1
printf("a value after a++ : %d",a); //a=2
a = 1;
printf("a value:%d",a);
b = ++a; // pre-increment
printf("b value after ++a : %d",b); //b=2
printf("a value after ++a : %d",a); //a=2
a = 5;
printf("a value before decrement: %d",a);
b = a--; // post
printf("b value after a-- : %d",b); // b=5
printf("a value after a-- : %d",a); // a=4
a = 5;
printf("a value: %d",a);
b = --a; // pre - decrement
printf("b value after --a : %d", b); // b=4
printf("a value after --a : %d",a); // a=4
}