Which of the two is faster? 0==1 or 0==2
Both are equal
0==1
0==2
Runtime variation
Answers
Answered by
0
Answer:
both are equal, as there is no difference in operation, just the values are different
Answered by
0
Answer:
I said that both have the same execution speed, as the expression inside while should finally evaluate to true or false. In this case, both evaluate to true and there are no extra conditional instructions inside the while condition. So, both will have the same speed of execution and I prefer while (1).
But the interviewer said confidently: "Check your basics. while(1) is faster than while(2)." (He was not testing my confidence)
Similar questions