Open In App

C Hello World Program

Last Updated : 14 Jan, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

The “Hello World” program is the first step towards learning any programming language. It is also one of the simplest programs that is used to introduce aspiring programmers to the programming language. It typically outputs the text "Hello, World!" to the console screen.

C Program to Print "Hello World"

To print the “Hello World”, we can use the printf function from the stdio.h library that prints the given string on the screen. Provide the string "Hello World" to this function as shown in the below code:

C
// Header file for input output functions
#include <stdio.h>

// Main function: entry point for execution
int main() {

    // Writing print statement to print hello world
    printf("Hello World");

    return 0;
}

Output
Hello World

Explanation:

  • #include <stdio.h> – This line includes the standard input-output library in the program.
  • int main() – The main function where the execution of the program begins.
  • printf(“Hello, World!\n”); – This function call prints “Hello, World!” followed by a new line.
  • return 0; -This statement indicates that the program ended successfully.

To go beyond the basics and explore data structures and more advanced topics, the C Programming Course Online with Data Structures takes you from beginner to expert


Next Article

Similar Reads