Site icon DataFlair

C Increment and Decrement Operators

Program 1

// Program to understand increment  and decrement operator
#include<stdio.h>
#include<conio.h>
int main()
{
     system("cls");
        int a=5,b,c;  
         b=++a;
         c=--b;
         a=c--;
         b=++a;
         /*
              a=6
              b=6
              c=4
         */
         printf("\n a=%d",a);
         printf("\n b=%d",b);
         printf("\n c=%d",c);
          
         

     return 0;
}

 

Exit mobile version