Hello,
I have a silly question:
Why do programmers use the ternary operator as shown in the abs2 function with the extra pair of brackets enclosing the conditional statement? To improve readability? As far as I know the < operator has higher precedence so the code in abs1 below is perfectly valid.
Code:int abs1(int a) { return (a < 0 ? -a : a); } int abs2(int a) { return ((a < 0) ? -a : a); }