Monday 9 September 2013

?: ternary opertor

?: in programming language is a ternary operator. In a nutshell it means:

condition ? value_if_true : value_if_false

use in the min and max function in C:

float min(float a, float b)
{
       return (a<b?a:b);
}

float max(float a, float b)
{
      return (a<b?b:a);
}

No comments:

Post a Comment