 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Write a C program to demonstrate post increment and pre increment operators
Increment operator (++)
- It is used to increment the value of a variable by 1. There are two types of increment operators, pre-increment and post-increment. 
- The increment operator is placed before the operand in pre-increment and the value is first incremented and then the operation is performed on it. 
For example,
z = ++a; a= a+1 z=a
- The increment operator is placed after the operand in post-increment and the value is incremented after the operation is performed. 
For example,
z = a++; z=a a= a+1
Example 1
Following is an example for pre-increment operator −
main ( ){    int A= 10, Z;    Z= ++A;    printf ("Z= %d", Z);    printf (" A=%d", A); } Output
Z =11 A=11
Example 2
Following is an example for post-increment operator −
main ( ){    int a= 10, z;    z= a++;    printf ("Z= %d", z);    printf ("A=%d", a); } Output
Z=10 A=11
Decrement operator (- -)
- It is used to decrement the values of a variable by 1. There are two types of increment operators, pre decrement and post decrement. 
- The decrement operator is placed before the operand in pre decrement and the value is first decremented and then the operation is performed on it. 
For example,
z = - - a; a= a-1 z=a
- The decrement operator is placed after the operand in post decrement and the value is decremented after the operation is performed 
For example,
z = a--; z=a a= a-1
Example 1
Following is an example for pre decrement operator −
main ( ){    int a= 10, z;    z= --a;    printf ("Z= %d", z);    printf (" A=%d", a); } Output
Z=9 A=9
Example 2
Following is an example for post decrement operator −
main ( ){    int a= 10, z;    z= a--;    printf ("Z= %d", z);    printf ("A=%d", a); } Output
Z=10 A=9
