More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
Ans. Ternary operator , also called conditional operator is used to decide which value to assign to a variable based on a Boolean value evaluation. It is used as
condition ? value1 : value2
For example
int y = (x > 0) ? x:0; // assign x if it's greater than 0, else assign 0
Help us improve. Please let us know the company, where you were asked this question :