Hello ladies and gents,
Ive got an exercise in which I have to fully parenthesize expressions using the higher-lower precedence, for instance:
a+b*c would become (a+(b*c)) because multiplication has a higher precedence then addition.
Here are my solutions for the following expressions:
1) a = b + c * d << 2 & 8
(a = ((b + (c * d)) << 2 & 8))
2) a & 077 != 3
Don't think there is a solution for this since & is "adress of", but how can you have an adress of 077?
3) a == b || a == c && c < 5
(((a == b) || ((a == c) && (c < 5))))
4) c = x != 0
(c = (x != 0))
5) 0 <= i < 7
((0 <= i) < 7)
6) f(1, 2) + 3
((f(1, 2)) + 3)
7) a = - 1 + + b -- - 5
Don't think there is a solution either since the expressions are not correct?
8) a = b == c ++
(a = (b == (c ++)))
9) a = b = c = 0
(a = (b = (c = 0)))
10) a[4][2] *= * b ? c : * d * 2
((a[4][2]) *= (* b ? c : ((* d) * 2)))
11) a-b, c=d
((a-b), (c=d))
I was hoping that you guys could check these out and tell me which ones are wrong?
Thank you.