Hacker News new | ask | show | jobs
by dlcarrier 129 days ago
It's really easy to make a C hello world program that forwards the success of printf:

    #include <stdio.h>
    int main(void)
    {
        return printf("hello, world\n");
    }
I just tested it in a Bash shell, and it works great, only adding a single word, with clear functionality, to the example.
1 comments

This program will always give a non-zero return code. This is unconventional if not straight up wrong, if the goal is for main to indicate whether it was successful in printing.