if ( x && y ) or if ( x ) then if ( y ) ...

James K. Huggins huggins at zip.eecs.umich.edu
Sat Aug 18 02:47:30 AEST 1990


In article <5781 at uwm.edu> andrew at csd4.csd.uwm.edu (Andy Biewer) writes:
| [...] I have been wondering for quite
|some time now about what, if any, differences there are between the two
|conditional statements:
|
|  1)  if ( x && y )
|          statement;
|
|  2)  if ( x )
|          if ( y )
|               statement;
|
|It may be a trivial question, however, is there any?  Will `y' in the first
|conditional be tested if `x' fails?  I know that it won't in the second.
K&R 2 specify that if 'x' fails (i.e. has value 0), 'y' will not be
tested.
 
Jim Huggins, Univ. of Michigan



More information about the Comp.lang.c mailing list