×
☰ Menu

Increment and Decrement Operators

 

Operator

Description

Example

++

Increment operator

a++; or ++a;

a=10;

a=a+1;

--

Decrement operator

a--; or --a;

a=10;

a=a-1;

 

 

Code:

#include <stdio.h>

main() {

   int a = 10;
  
   int c ;
	
   c = a++; 
   printf("a++ =%d\n", c );
	
   c = a--; 
   printf("a--= %d", c );
}

 

 

Output: 

a++ =10
a--= 11
--------------------------------
Process exited after 1.05 seconds with return value 0
Press any key to continue . . .