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; }
One if can only have one else.
And anything that doesn't match the if will (!) enter the else.
Your code have an extra else that isn't matched by a previous if.
And you then suddenly compare your int-valued parameter with the address the compiler/linker used to store the text string "0".
A good programming book and some quality time reading it is the best investment - you will just waste time doing trial-by-error programming.
i will try more code but it is very difficult
will you tell me what is the same as parameter and argument?
Why do you want to try more code?
Isn't it better to understand the code instead of doing wild experiments?
This is your last code with extra braces added to show what the compiler will do with the code.
if (myparameter == 7) { return BOOL_TRUE; } else { if (myparameter == 29) { return BOOL_FALSE; } else { return 23; } } else { <=== this else doesn't belong to any if!!! // "0" isn't a number but an address to a text string... if (myparameter != "0") { return 27; } else { return 5; } }
Read books and learn to understand code. Don't guess.
Greeting Kalim Rohgash
Did you get your code fixed. I have a same problem and do not know what to fix.