What does ? in C mean?

后端 未结 8 1339
春和景丽
春和景丽 2020-11-27 20:41

What does a question mark (?) in C mean?

相关标签:
8条回答
  • 2020-11-27 21:22

    ? is the first symbol of the ?: ternary operator.

    a = (b==0) ? 1 : 0;
    

    a will have the value 1 if b is equal to 0, and 0 otherwise.

    0 讨论(0)
  • 2020-11-27 21:22

    Its the ternary operator, see http://en.wikipedia.org/wiki/Ternary_operation#C.2C_C.2B.2B.2C_C.23.2C_Objective-C.2C_Java.2C_JavaScript.2C_ActionScript

    0 讨论(0)
提交回复
热议问题