This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

"else" instruction doesnt get xcuted

Hi All,
Using uVision simulator and Keil arm or
GNU compiler, the "else" instruction never gets xcuted. Using MSVC++ it does get xcuted.

Anyone know why?? puzzleing.
Thanks
----------------------------
int main (void){
unsigned int i=0,result=0;

for (i=0;i<5;i++){
if (i>3)
result=i*10;
else
result=i*5;
}

return(1);
}//main
--------------------------------

Parents
  • >> BTW: what do you think will happen to the return value from main...?

    For what it's worth, GCC complains if main() does not return a value because it is declared to return type int. If you change it to return type void, it complains about that too, so having it return something keeps GCC happy.

    Kathy

Reply
  • >> BTW: what do you think will happen to the return value from main...?

    For what it's worth, GCC complains if main() does not return a value because it is declared to return type int. If you change it to return type void, it complains about that too, so having it return something keeps GCC happy.

    Kathy

Children
No data