形式:表达式1?表达式2:表达式3。
语义:当表达式1为true时,结果为表达式2,否则结果为表达式3。
【代码2.7】条件运算符案例
代码2.7的运行结果为
Value of b is:30
Value of b is:20