0

enter image description here

May I ask what does this means? How does %s derive can / cannot ?

**

printf("These %s be the lengths of sides of a valid triangle.\n",
           valid_triangle(a, b, c) ? "can" : "cannot");
}

**

0

It is called the "ternary operator" and it's a nice bit of shorthand for an if-else block. You could interpret ? "can" : "cannot" as if expression evaluates to true then "can" else "cannot" where "expression" is valid_triangle(a, b, c).

You can find lots of articles and info on the ternary operator by searching the internet-at-large. Here is one example.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .