Crack the code: ‘x’ value will be modified after substitution into expression as it was post-increment.
#include<stdio.h>
main()
{
int x=5,y;
y=x++;
printf("%d,%d",x,y);
}
Crack the code: ‘x’ value increment 2 times and the final value will be substituted into expression.
#include<stdio.h>
main()
{
int x=5;
x = ++x + ++x;
printf("%d",x);
}
Crack the Code: ‘x’ value increments by 1 as there is one pre-increment operator and value will be substituted in expression. After evaluation of expression, the ‘x’ value will be modified by 1 as there is post increment operator also.
#include<stdio.h>
main()
{
int x=5;
x = x++ + x++;
printf("%d",x);
}
Crack the Code :
#include<stdio.h>
main()
{
int x=10,y=20,z;
z = x++ * --y ;
printf("%d,%d,%d",x,y,z);
}
Crack the Code :
#include<stdio.h>
main()
{
int x=3,y=7,z;
z = ++x * y-- ;
x = y-- + ++z ;
y = z-- + x++ ;
printf("%d,%d,%d",x,y,z);
}
Crack the Code:
#include<stdio.h>
main()
{
int x=5,y=4,z;
z = x-- - ++y ;
x = z-- + --y ;
z = --x - ++y ;
z = ++y + --x ;
printf("%d,%d,%d",x,y,z);
}
Note: In the function call, element evaluate from right to left and display the values from left to right.
#include<stdio.h>
main()
{
int a=5;
printf("%d,%d,%d",++a, ++a , ++a);
}