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

Conversion problem

uint64_t build_table ( int32_t myparameter ) {

 if ( myparameter == 7 ) {
   return BOOL_TRUE;
 }
 else if
 (myparameter == 29 ) {
   return BOOL_FALSE;
  }
  else
 {
   return 23;
 }

 return 5;
}


Parents
  • So why should you get 5 back when you send in 0?

    Maybe you could explain exactly how you think your program can print the value 5?

    uint64_t build_table ( int32_t myparameter ) {
        if (myparameter == 7) {
            return BOOL_TRUE;
        } else if (myparameter == 29) {
            return BOOL_FALSE;
        } else {
            return 23; <== exactly why shouldn't input 0 reach this line?
        }
    
        return 5; <== exactly how do you expect your program to reach this line?
    }
    

    Exactly why do you think 0 is magical and should ignore the "return 23" statement?

Reply
  • So why should you get 5 back when you send in 0?

    Maybe you could explain exactly how you think your program can print the value 5?

    uint64_t build_table ( int32_t myparameter ) {
        if (myparameter == 7) {
            return BOOL_TRUE;
        } else if (myparameter == 29) {
            return BOOL_FALSE;
        } else {
            return 23; <== exactly why shouldn't input 0 reach this line?
        }
    
        return 5; <== exactly how do you expect your program to reach this line?
    }
    

    Exactly why do you think 0 is magical and should ignore the "return 23" statement?

Children
No data