? and = do not go hand-in-hand

csp at gtenmc.UUCP csp at gtenmc.UUCP
Sat Mar 30 10:51:35 AEST 1991


To someone with a macro problem :-

The problem is not with the 'macro'.

funct(a,b,c,d)
float a,b,c,d;
{
   return( d == 0 ? a = 0 , b = c : ( a = c / d , b = c - a * d ));
				    ^
   This bracket is nescessary otherwise the scope of the '?' operator is
 upto '=' after the ':' and not including it. Since assignment has a lower
 precedence than the '?' operator.

 In short the attempt is to assign a value to a value which is senseless.

}

C S Palkar
--



More information about the Comp.lang.c mailing list