Hello World! · C

Ch 2 · Your First C Program — card 1 of 2.

Every C program starts in a function called main. To print text we use printf, which lives in the standard input/output library — so we include it at the top with #include <stdio.h>. The \n inside the text means "new line." Every statement ends with a semicolon ;, and main ends with return 0;, which tells the system the program finished successfully.

#include <stdio.h>

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