I am using keil evaluation version. When i use debug for following program in keil, it skips the else part altogether. It goes to line 1,2 and then 7. Whats wrong with it.
1 a = 1; 2 if(a == 2){ 3 a = 4; 4 }else{ 5 a = 5; 6 } 7 while(1);
Must be optimization. Most likely, the variable a is not used anywhere, so the compiler removed all the code in lines 1-6.
Regards, - mike
Even if a where used elsewhere, the code is equivalent to:
a = 5; while(1);