Qualcomm Interview Question
Software Engineer / Developerstemp is not initialized to any value and its basically an infinite loop
the compiler can optimize it as
while(1)
this doesnt require fiddling with temp variable
@ newlifeseattle
but in the above code..the compiler will not optimize the code even if the variable is a local variable bcoz the temp value changes each and every time...
can you please explain why the compiler wont optimize if the value of temp changes each and every time...Thanks
basically if temp is not defined as volatile, the compiler will optimize the code as
- newlifeseattle December 31, 2009while(temp--).