Question: The following code compiles without problems:

```
int main() {
    printf("Hi" "Bye");
}

```

However, this does not compile:

```
int main() {
    int test = 0;
    printf("Hi" (test ? "Bye" : "Goodbye"));
}

```

What is the reason for that?

Answer: 
String literal concatenation is performed by the preprocessor at compile-time. There is no way for this concatenation to be aware of the value of `test`, which is not known until the program actually executes. Therefore, these string literals cannot be concatenated.

Because the general case is that you wouldn't have a construction like this for values known at compile-time, the C standard was designed to restrict the auto-concatenation feature to the most basic case: when the literals are literally right alongside each other.

But even if it did not word this restriction in that way, or if the restriction were differently-constructed, your example would still be impossible to realise without making the concatenation a runtime process. And, for that, we have the library functions such as `strcat`.
> 
> What is the reason for that?
> 
> 
> 

Your code using ternary operator conditionally chooses between two string literals. No matter condition known or unknown, this can't be evaluated at compile time, so it can't compile. Even this statement `printf("Hi" (1 ? "Bye" : "Goodbye"));` wouldn't compile. The reason is in depth explained in the answers above. Another possibility of *making such a statement using ternary operator valid to compile*, would also involve a *format tag* and the result of the ternary operator statement formatted as *additional argument* to `printf`. Even then, `printf()` printout would give an impression of "having concatenated" those strings only at, and as early as *runtime*.

```
#include <stdio.h>

int main() {
    int test = 0;
    printf("Hi %s\n", (test ? "Bye" : "Goodbye")); //specify format and print as result
}

```