Fundamentals 4 min read

How "Hello, World!" Became Every Programmer’s First Code

Tracing its origins from a 1972 Bell Labs B‑language memo to the ubiquitous C example popularized by K&R, this article explains why the simple “Hello, World!” program became the universal first program, showing the original source code and its cultural significance in programming education.

Liangxu Linux
Liangxu Linux
Liangxu Linux
How "Hello, World!" Became Every Programmer’s First Code

Origins of the "Hello, World!" tradition

When learning to program, the first program most beginners write prints the phrase "Hello, World!". This convention dates back to the early 1970s and has become a cultural hallmark of programming education.

1972: The B‑language introduction

In 1972, Brian Kernighan at Bell Labs authored an internal memo titled A Tutorial Introduction to the Language B , where he first used the string "Hello World". To demonstrate external variables, he wrote a B‑language program that split the phrase into three variables because each character constant could hold only four ASCII characters.

main() {
    extern a, b, c;
    putchar(a); putchar(b); putchar(c); putchar('!*n');
}
a 'hell';
b 'o, w';
c 'orld';

This program prints "hello, world" followed by a newline.

1974: Transition to C and the K&R example

By 1974, the C language was supplanting B. Kernighan wrote another internal memo, Programming in C: A Tutorial , which included a C version of the Hello World program. The same example later appeared in the seminal book The C Programming Language (1978) by Kernighan and Dennis Ritchie.

int main() {
    printf("hello, world
");
    return 0;
}

In this code, main() defines the program’s entry point, and the single printf call outputs the literal string.

Why the phrase endures

Since then, "Hello, World!" has become a standard teaching example, symbolizing the moment a learner’s code first produces visible output. It marks the entry point into the world of programming and carries historical and cultural significance across dozens of programming languages.

Below are examples of the Hello World program in various languages:

These examples illustrate how the simple phrase has been adapted across many programming languages, reinforcing its role as a universal entry point for new coders.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

C languagefundamentalsHello Worldprogramming historyB language
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.