» Quick Introduction to C » 1. Basics » 1.1 Hello World

Hello World

C is a general-purpose computer programming language. It was created in the 1970s by Dennis Ritchie, and remains very widely used and influential.

If you want to be a great programmer, C is a must.

Let's start with a classic "Hello World".

#include <stdio.h>

int main() {
    printf("Hello World!\n");
    return 0;
}

This program prints "Hello World" to the console.

Includes

#include <stdio.h> // Include a header file from standard library
#include "../include/foo.h" // Include a local custom header file

Includes are instructions to the preprocessor to include external code.

Comments

/*
 * This is a block comment.
 */

// This is a line comment.

Comments are used to write programmers' notes that is to be ignored by the compiler at build time. As you see there, a line comment starts with double slashes //, and a block one is wrapped by /* ... */.

Code Challenge

Try to modify the code provided in the editor to make it print Hello, C! Here I am!.

Loading...
> code result goes here
Next