Interview Question

Software Engineer Interview

More qns about pointers! And assignments in if and while

  looks. if ( a = b) {} and while(a=b) {}
Answer

Interview Answer

2 Answers

0

while a = b gives an infinite loop and if a = b will always be true and will assign a the value of b

A on Apr 30, 2013
0

Like you said, the answer depends on b. If b = 0, both expressions would then be false.

B on Jun 5, 2013

Add Answers or Comments

To comment on this Question, Sign In with Facebook or Sign Up