C code ? :

Hi all

i have been searching for a while now to understand the syntax of ? : because sometimes i see poeple use this. but i dont understand what it does?

can some one explain this?

/Spirit

? : <if false, take this value>

thanks!

Its called a ternary operator - the only one in C. You can easily google it.

yes i did but i think i googled the wrong words. i realy could not find it!
and i realy did not know what to search for.

only i dont know if it is better or worse or equal then if(){}else{}

only i dont know if it is better or worse or equal then if(){}else{}

If you understand it, it's as good. If you don't, it isn't. The compiler will generate the same code.

You can find an overview here: Operators in C and C++.