0

Ex : ---++x can it be?

example if int x = 0 ---x++ //<-- can it be? then how the answer?

17th Dec 2016, 4:50 PM
Abas
Abas - avatar
3 Answers
+ 1
#include<iostream> using namespace std; int main() { int x=0; ---x++; cout<<x; } output : error Compiler throws error : left value required as decrement operand To make it work fine then you must use parenthesis () #include<iostream> using namespace std; int main() { int x=0; -(--x)++; cout<<x; } output : 0 if you make x as signed int x then #include<iostream> using namespace std; int main() { signed int x=0; ---x++; cout<<x; } output : -1 hope you understood
17th Dec 2016, 5:07 PM
Mock
Mock - avatar
0
thanks a lot bro
17th Dec 2016, 5:39 PM
Abas
Abas - avatar
0
welcome buddy !
17th Dec 2016, 5:47 PM
Mock
Mock - avatar