Answers for "single line if c++"

C++
5

single line if c++

a = (x > y) ? z : y;

/* Same as */

if (x > y)
{
    a = z;
}
else
{
    a = y;
}
Posted by: Guest on June-18-2020
3

one line if statement c++

x = condition ? expression1 : expression2

// Example:
double x = (1 > 0) ? 10 : 20; // put any value
Posted by: Guest on December-03-2020

Browse Popular Code Answers by Language