Answers for "how to check a condition using one line in c"

C
0

how to check a condition using one line in c

#include <stdio.h>

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

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

    return 0;
}
Posted by: Guest on January-21-2022

Code answers related to "how to check a condition using one line in c"

Code answers related to "C"

Browse Popular Code Answers by Language