Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c/c++ ? 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
}
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #operator
ADD COMMENT
Topic
Name
7+1 =