A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
RabbitMQ in Depth
this week in the
help me solving this question in C
Joined: Jan 21, 2010
Aug 14, 2010 01:38:15
Q:What is the output :
var2=var2 || var++ && printf("Computer World");
the answer coming out is :4 1
My problem is how this is executing...
If you are going to say that this is SHORT CIRCUIT then my question to you is :
How the precedence is being followed in this expression?
Because in this precedence should be like:
Do consider this also
2+3*4+6 since *(multiply) has higher precedence than + thus we calculate * before +
Same must be applied in the above program if we go by the precedence...
Joined: May 03, 2008
Aug 14, 2010 02:06:40
Why the double post in a forum where a C related question is so obviously off topic?
There are no new questions, but there may be new answers.
Joined: Oct 13, 2005
Aug 14, 2010 02:24:15
You beat me by 17 minutes, DB, and thank you for noticing.
Jatin sachdev, you should by now know to
use one forum
I agree. Here's the link:
subject: help me solving this question in C
Byte -- what's going on
How to add two variables in XSLT
How Instance variables get Default values
<c:forEach> to iterate a collection
Operator Precedence involving && and ||
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015