The simplest hello world program you can write in C.

Posted: May 25, 2014. At: 8:03 PM. This was 4 years ago. Post ID: 7316
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

This is a very simple Hello World program that you can write in C.

int main (void) {
    write (1, "Hello World\n", 14);
    return 0;

Just compile the program like this:

localhost% cc minimal.c -o small
minimal.c: In function ‘main’:
minimal.c:2:5: warning: implicit declaration of functionwrite[-Wimplicit-function-declaration]
     write (1, "Hello World\n", 14);

Then execute it to get the output. This is very easy.

localhost% ./small 
Hello World

This little program is very small indeed.

localhost% ls -hula ./small 
-rwxr-xr-x. 1 jason jason 8.4K May 25 09:28 ./small

I wonder if you could strip this program down even more and make it even simpler. An interesting exercise indeed.

No comments have been made. Use this form to start the conversation :)

Leave a Reply