Remember precedence rules: (was Re: use of if (!cptr))

Leslie Mikesell les at chinet.chi.il.us
Wed Jul 26 04:27:30 AEST 1989


In article <1984 at cbnewsc.ATT.COM> mackey at cbnewsc.ATT.COM (ron.mackey) writes:

>> while (myptr = my_func() && myptr->x != myptr->y) {

>It would also be incorrect since "&&" binds tighter than "="
>Your expression would be evaluated as follows:

Oops - point well taken; make that:
   while ((myptr = my_func()) && myptr->x != myptr->y) {

...and I just checked some code to make sure I had actually done it
that way.

Les Mikesell



More information about the Comp.lang.c mailing list