Which one will execute faster, if (flag==0) or if (0==flag)?

后端 未结 16 796
灰色年华
灰色年华 2020-11-30 17:12

Interview question: Which one will execute faster, if (flag==0) or if (0==flag)? Why?

16条回答
  •  一生所求
    2020-11-30 17:47

    I think the best answer is "what language is this example in"?

    The question did not specify the language and it's tagged both 'C' and 'C++'. A precise answer needs more information.

    It's a lousy programming question, but it could be a good in the devious "let's give the interviewee enough rope to either hang himself or build a tree swing" department. The problem with those kinds of questions is they usually get written down and handed down from interviewer to interviewer until it gets to people who don't really understand it from all the angles.

提交回复
热议问题