Write a C program to Display Hello World (With Code Sample).


 

INTRODUCTION

This tutorial teach you how to write a C program that display hello world. The hello world program is mostly the very first program written by most beginners learning different programming language. The above tutorial did not only stopped at displaying the text "Hello World" it explains all part of the code in simple plain manner that a beginner will understand and remember.

CODE SAMPLE

#include<stdio.h>

int main(){

    printf("Hello World");

    return 0;

}

EXPLANATION

#include<stdio.h>

The first line of code is called a preprocessor directive. It includes the standard(std) input/output (io). The function of this header file is to provide function for input/output operations example printf, scanf, getchar and putchar. In a simple term including stdio.h allows you to perform input/output operations in your C program. Also stdio.h defines macros such as end-of-file (EOF)

 printf("Hello World");

Print the text Hello world to the screen.

return 0;

The return is a statement that signifies the successful termination of a program. It is used to signal to the operating system (OS) that the program completed without any error.

TRY IT YOURSELF

Change the string to your full name "First name, middle name and last name" Run the program and see the result.

CONCLUSION.

The tutorial teaches you how to write a program in c programming language. Most importantly, the tutorial explains the function of the stdio.h in a C program in details and in simple term.

Ameh Joseph Onyeke

Hello and welcome to my blog! My name is Ameh Joseph Onyeke a passionate educator and tech enthusiast with a BSc in Computer Science from Benue State University, a PGDE from the University of Maiduguri, and a Master’s in Software Engineering from Bayero University Kano. My journey blends a strong foundation in computing with a love for teaching, aiming to simplify complex tech concepts for learners at all levels. Through this blog, I provide answers and insights across 10+ programming languages to support students and tech enthusiasts in building their skills and confidence. Whether you're solving coding problems or sharpening your programming abilities, this blog is here to guide you. Let’s learn and grow together!

Post a Comment

Previous Post Next Post