0

what will the out be ? And why ?!

#include<iostream> using namespace std ; int main () { int x=3 ,y=1 ; x = y+++x ; y = --y+x-y ; cout<< x << y ; return 0 ; }

17th Apr 2017, 1:02 AM
Hassan Ashraf
Hassan Ashraf - avatar
2 ответов
+ 2
x = 4 ,y = 4 on line x= y++ + x here y = 1 and x = 3 become 4 and y increment bt 1 on line y=--y+x-y here y =2 x=4 first y is decremented and then calculation done y = 1+4-1 y=4
17th Apr 2017, 1:35 AM
Rohan Vijayvergiya
Rohan Vijayvergiya - avatar
+ 1
Read more about "Prefix" and "Postifx" incrementors / decrementors.
17th Apr 2017, 4:24 AM
***
*** - avatar