Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

ternary operator in c

#include <stdio.h>

int main()
{
    printf("Hello World
");

    char str1[5] = "test";
    char str2 = NULL;
    printf("
result: %s", str1 ? "str is not empty" : "str is empty");
    printf("
result: %s", str2 ? "str is not empty" : "str is empty");

    return 0;
}
 
PREVIOUS NEXT
Tagged: #ternary #operator
ADD COMMENT
Topic
Name
7+6 =