Knowledge Walls
Venkatesan
Hyderabad, Andhra Pradesh, India
Passcode:
Introduction [cont'd]
Input Output Functions [cont'd]
Structures and Unions [cont'd]
# Preprocessor [cont'd]
Increment & Decrement Operators in Operators of Programming in C
2034 Views
Increment & Decrement Operators 
Increment and decrement operators are used to increase or decrease the variable value by 1. It is doing postincrement or preincrement. postincrement is assigning the value to the variable then increasing(a = b++;). Preincrement is increasing the value before assign the value to the left hand side variable(a = ++b;).
Operators and meaning 
Operators Name Meanings Example
a++ Post increment Increase the value after assign to the variable. b = a++;
++a pre increment Increase the value before assign to the variable. b = ++a;
a-- Post decrement Decrease the value after assign to the variable. b = a--;
--a pre decrement Decrease the value before assign to the variable. b = --a;
Program
#include
void main(){
   int a,b,c;
   a = 30;b = 20;
   c = a++;
   printf("C = %d\n",c);
   c = ++b;
   printf("C = %d\n",c);
}
Output 
C = 30
C = 21
Next Topics
Next lessons of current book.
Input Output Functions of Programming in C
Previous Topics
Previous lessons of current book.
Introduction of Programming in C
Best Lessons of "Programming in C"
Top lessons which are viewed more times.
Structures and Unions of Programming in C
Input Output Functions of Programming in C
Structures and Unions of Programming in C
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details