Interesting little bug here:
if (host != NULL) {
printf("hi");
} else {
printf("FAIL");
}
return 0;
doesn\'t prin
printf output to stdout is buffered. You might want to look at fflush
The difference is the \n characters.
As you printf characters, they are accumulated in a buffer which isn't sent to the output device until an 'end of line' character is sent.
try using fflush(stdout)
before your if
condition.