Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

c ternary operator

#include <iostream>

int main() 
{
	int value = (1 > 0 ? 12 : 41);
  	/*
    if 1 > 0 then value is 12, else 41
    */
  	int val2 = (1 > 0 ? (2 > 4 ? 42 : 45) : 41); // nested
}
 
PREVIOUS NEXT
Tagged: #ternary #operator
ADD COMMENT
Topic
Name
6+6 =