[vox-tech] logical operator precedence in C?

Brian Lavender brian at brie.com
Sat May 22 20:51:44 PDT 2010


On Sat, May 22, 2010 at 10:29:47PM -0500, Chanoch (Ken) Bloom wrote:
> On Sat, 2010-05-22 at 20:22 -0700, Brian Lavender wrote:
> > in C. What is the order of precendence?
> > 
> > a || b || c && d || e || f
> > 
> > Is it just left to right?
> > 
> > brian
> 
> http://www.difranco.net/cop2220/op-prec.htm
> 
> && has higher precedence than ||, so your expression is evaluted as 
> a || b || (c && d) || e || f
> 
> Many other programming languages adopt C's precedence rules.

Thanks, nice list to have handy.

-- 
Brian Lavender
http://www.brie.com/brian/

"There are two ways of constructing a software design. One way is to
make it so simple that there are obviously no deficiencies. And the other
way is to make it so complicated that there are no obvious deficiencies."

Professor C. A. R. Hoare
The 1980 Turing award lecture


More information about the vox-tech mailing list