Basic

Switch Case

Goto

Operators

if Statement

Nested if

While Loop

For Loop

Array

Patterns

Excersises


Increment and Decrement Operators in C Program


Increment ++ Operators are used to increase the existing value of the variable by one.Decrement -- Operators are used to decrease the existing value of the variable by one.

Operator Description
++i
Pre Increment Operator
i++
Post Increment Operator
--i
Pre Decrement Operator
i--
Post Decrement Operator

Example : pgm.c

#include<stdio.h>
int main(){
    int a=10;

    printf("\nValue of a : %d",++a); //11
    printf("\nValue of a : %d",a++); //11
    printf("\nValue of a : %d",a);   //12

    printf("\nValue of a : %d",--a); //11
    printf("\nValue of a : %d",a--); //11
    printf("\nValue of a : %d",a);   //10

    return 0;
}