Skip to main content
To Get All Information of Sarkari Jobs | Results | Admit Card | And courses ,Internships then CLICK HERE

Increment and Decrement Operator-:


 Increment and Decrement Operator are unary in nature i.e. it require single operand to perform an operation.Increment operator is represented by "++" while decrement operator is represented by "--".
  Increment-:  Pre increment    [ ++i ]
                        Post increment    [ i++ ]
 Decrement-:  Pre decrement     [ -- i ]
                        Post decrement     [ i -- ]
Increment operator increments the value of operands by 1 while decrement operator decrements the value of an operands by 1.                                                                                                                        ads


Example-: 
Increment operator:-     
#include<stdio.h>
#include<conio.h>
void main()
{int x,i;
i=10;
x=++i + i++;
printf("x: %d",x);
printf("i: %d",i);
getch();
}         output-:  i=12
                  x=22
Decrement operator:-
#include<stdio.h>
#include<conio.h>
void main()
{int x,i;
i=15;
x=i-- + --i;
printf("x=%d",x);
printf("\n i=%d",i);
getch();
}         output-:  i=28
                  x=13
Watch The Video Below

                                                       ads

Comments

Post a Comment

Please do not enter any spam link in the comment box.


Download The Book "Let Us C" By Yashavant P.Kanetkar,Click The Below Button

-->Email Subscription

Enter Your Email Address:-

Delivered by FeedBurner

Copyright © 2020 TechProgramiz|All Right Reserved|Made By-: Sudarshan Pandey