This is too basic I think, but how do both of these work?
return true; // 1
and
return (true); // 2
Similar: sizeof, exit
My guess:
If return was a function,
1would be
erroneous.So, return should be a
unarythat can also take in
operator
brackets… pretty much likeunary:
minus-5and-(5), both are
okay.
Is that what it is – a unary operator?
returnis a keyword that manipulates control flow. In that it’s similar toif,foretc. It can be used with or without an expression (return;returns from avoidfunction). Of course, as with all expressions, extra parentheses are allowed. (Soreturn (42);is similar toint i = (4*10+2);, in both cases the parentheses are redundant, but allowed.)sizeofis a keyword that is an operator, similar tonew,delete,+,->,::, etc.std::exit()is an identifier that denotes a function of the C standard library (which never returns to the caller).