Home / Programs / Write a program to demonstrate the results obtained by using the increment operators on operands with pre- and post- effect.
Programming Example

Write a program to demonstrate the results obtained by using the increment operators on operands with pre- and post- effect.

👁 5,520 Views
💻 Practical Program
📘 Step by Step Learning
Write a program to demonstrate the results obtained by using the increment operators on operands with pre- and post- effect.

Program Code

/*
 Program: Write a program to demonstrate the results obtained by using the
  increment operators on operands with pre- and post- effect.  
  
 Author: www.atnyla.com  
 
*/ 

#include "stdio.h" 
int main()
{
int x=5;
printf("Values are %d and %d\n",x++,++x);
return 0;
} 

Output

Values are 6 and 6
Press any key to continue . . .

Explanation

None

How to learn from this program

First read the algorithm, then study the program code line by line. After that, compare the code with the output and finally go through the explanation. This approach helps learners understand both the logic and the implementation properly.