Why is this not working with printf() in c
c, printf, string
Solution
String literal joining is a lexical feature, which means this:
(i==1) ? " " : " " "hello"
is the same as this:
(i==1) ? " " : " hello"
It should now be pretty obvious why you get the result you get.
Problem
I have the following code: ``` int i=1; printf((i==1)?" ":" " "hello"); printf(" " "hello"); ``` And I am astonished to see that the first `printf` only gives a space as output and the second `printf` outputs a space followed by the string hello. I was expecting output like second one in case of first one. But is there something here I am missing. Please help me with this ...