What does ? in C mean?

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

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

8条回答
  •  感情败类
    2020-11-27 20:57

    That’s probably a part of the ternary operator:

    const int numApples = …;
    printf("I have %i apple%s.\n", numApples == 1 ? "" : "s");
    

提交回复
热议问题