Increment and Decrement Operators in C - Part 2

Notes:

Increment and Decrement operators in C - Part 2

Increment and Decrement Operators:
- are used to increment or decrement a variable value by 1

++ : Increment Operator : is used to increment a variable value by 1
Post Increment : variableName ++
Pre Increment : ++ variableName

-- : Decrement Operator : is used to decrement a variable value by 1
Post Decrement: variableName --
Pre Decrement : -- variableName

Example code 2:
#include <stdio.h>
int main()
{
int a = 10;
printf("a=%d\n",a); // 10
printf("a=%d\n",a++); // 10
printf("a=%d\n",a); // 11

int a = 10;
printf("a=%d\n",a); // 10
printf("a=%d\n",++a); // 11
printf("a=%d\n",a); // 11

int a = 10;
printf("a=%d\n",a); // 10
printf("a=%d\n",a--); // 10
printf("a=%d\n",a); // 9

int a = 10;
printf("a=%d\n",a); // 10
printf("a=%d\n",--a); // 9
printf("a=%d\n",a); // 9

return 0;
}