What is the output? increments x after/before the assignment 2 - C Operator

C examples for Operator:Increment Decrement Operator

Description

What is the output? increments x after/before the assignment 2

Demo Code

#include <stdio.h> 
int main() //  w  w w  .j  a va2s  .co m
{ 
   int x = 0; 
   int y = 0; 

   x = y++ * 4; 
   printf("\nThe value of x is %d\n", x);  

   y = 0; //reset variable value for demonstration purposes 
   x = ++y * 4; 
   printf("\nThe value of x is now %d\n", x); 
   
   return 0;
}

Result


Related Tutorials