top of page

First C Program - Hello World!

Updated: Feb 23

C is a general-purpose programming language that was first developed in the early 1970s by Dennis Ritchie at Bell Labs. C was created as an evolution of the B programming language, with the goal of creating a language that was both powerful and easy to use, and that could be used for a wide variety of applications.

One of the key features of C is its portability. C code can be compiled to run on a variety of different hardware platforms, making it a popular choice for systems programming, embedded systems development, and other low-level programming tasks.

Here is a C program that prints "Hello, world!" to the console:

#include <stdio.h>

int main() {
   printf("Hello, world!\n");
   return 0;

Let's break down the different parts of this program:

  • include<stdio.h>: This line tells the C compiler to include the standard input/output library, which contains functions for reading and writing to the console and other input/output devices.

  • int main() { ... }: This is the main function of the program, which is executed when the program is run. The int at the beginning of the line indicates that the function returns an integer value. In this case, the function returns 0 to indicate successful execution.

  • printf("Hello, world!\n");: This line uses the printf function from the standard library to print the string "Hello, world!" to the console. The \n at the end of the string is a special character that represents a newline, causing the next line of output to start on a new line.

  • return 0;: This line returns the value 0 from the main function, indicating successful execution of the program.

When this program is compiled and run, it will output "Hello, world!" to the console.

bottom of page