Login Register






Thread Rating:
  • 0 Vote(s) - 0 Average
Thread Closed 


Logic Unknown - help needed filter_list
Author
Message
Logic Unknown - help needed #1
i have run these codes

Code:
#include<stdio.h>
#include<conio.h>
int main(){
    int x,y=3;
    x=(y++)+(++y);
    printf("%d",x);
    getch();    
}

and got the output as

Quote:8

i thought
1stly,++y is evaluated then y increments to 4 and then y++ is evaluated but y does not increments that time ..
so x will show 7... but output i am getting is 8 .. i am using Dev c++ compiler ..

could anyone please tell me what is the actual logic for output = 8 ??
and is there any possibility to get output = 7 if different compiler is used ?

thanks a lot in advance
Confusedmiling:






Messages In This Thread
Logic Unknown - help needed - by Creed_mybb_import11544 - 04-17-2013, 07:31 PM



Users browsing this thread: 3 Guest(s)