char s[] = "hello";
Basic operators
int number;
// user inputs a value and it is put into number
int answer;
if (number >= 0) {
answer = number;
}
else
answer = 0;
}
Using the ?: operator, you can combine these operators:
int number;
// user inputs a value and it is put into number
int answer = (number >= 0 ? number : 0);
The code inside the parens evaluates to either number or 0 as the
? acts like an if, and then that value is assigned to answer.