ECE DEPARTMENT : NOTICE BOARD

ADVISORY TO STUDENTS (Answer to "Sir, College is there today ?")

Quote :
"If egg is broken by outside force, life ends. If broken by inside force, life begins. Great things always begin from inside force, trust yourself."

Batchwise blogs: -2008 | 2009 | 2010 | 2011 | 2012

Internal Marks Sem-II : | 2011 | 2010 | 2009 |

Intro | Case 1 | Case 2 | Case 3 | Case 4 | Case 5 |

Previous Posts

Saturday, July 03, 2010

Today's C Program


















Thats all for today
Happy weekend

4 comments:

  1. ans:4
    exp:here in the statement
    a <<=c>b>a^a relational greater & less than operators,
    3) ^ binary xor operator
    4) assignment = operator

    now if look at the statement carefully the left shift can't be evaluated first this is because its shift value is to be returned by the assignment operator= which is a<<=c and assignment as i said has least priority!

    so first the relational operators are evaluated here again the greater than and less-than operator have same priority, whenever two operators have same priority then they are evaluated according to their associativity which in this case is from left to right
    so the statment is evaluated like this:

    a<<=c>b>a^a3>2^2<5<3;
    a<<=1>2^2<5<3; operation: 5>3
    a<<=0^2<5<3;operation : 1>2
    a<<=0^1<3; operation:2<5
    a<<=0^1; operation:1<3
    a<<=1; operation:0^1
    a<<1; operation:=
    the above is same as
    2<<1 which is 4
    hence the op

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Manoj you are absolutely right.As in the given expression < and > having same priority.So execution will be Left -> Right.I must say this is one of the fantastic question.

    I have removed my previous comment.Just i don't want to confuse anybody,as i got.Hats off to respected sir and Manoj to you also.Thanks in taking me much deeper n deeper.

    ReplyDelete
  4. That is one good look at operator precedence !
    Well done , once again.
    I would love to see some more competition.
    Soumen & Manoj Thanks for your efforts.
    I shall remove the variations in timings while posting the C program exercises.

    FROM MONDAY, THE PROGRAM WILL BE AVAILABLE AT 5AM(IST) SHARP.

    ReplyDelete