associativity comes into play when operators are of same precedence.

On Sun, Jul 10, 2011 at 11:08 PM, vaibhav shukla <[email protected]>wrote:

> && has higher precedence than ||
>  the expression is evaluated as
> z=j || ( k && i );
> hence the output i.e 1 ;)
>
>
> On Sun, Jul 10, 2011 at 11:06 PM, rShetty <[email protected]> wrote:
>
>> #include<stdio.h>
>> int main()
>> {
>>  int i=0,j=1,k=1,z=0;
>>  z = j || k  && i ;
>>  printf("%d",z);
>>  return 0;
>> }
>>
>> The output is 1 for the above program .
>>
>> But according to associativity of logical operators , the evaluation
>> should be from left to right , But is it taking from right to left ?
>> What is the exact concept for the program behavior above?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
>   best wishes!!
> Vaibhav Shukla
>     DU-MCA
>
>


-- 
  best wishes!!
Vaibhav Shukla
    DU-MCA

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to