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 ; }
2 Réponses
+ 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
+ 1
Read more about "Prefix" and "Postifx" incrementors / decrementors.