Why do C languages require parens around a simple condition in an if statement?

If there are no brackets around expressions in if constructs, what would be the meaning of the following statement?

if x * x * b = NULL;

Is it

if (x*x)
    (*b) = NULL;

or is it

if (x)
    (*x) * b = NULL;

(of course these are silly examples and don’t even work for obvious reasons but you get the point)

TLDR: Brackets are required in C to remove even the possibility of any syntactic ambiguity.

Leave a Comment