Hello World Program in C.

The "Hello World" program is a traditional introductory program that displays the text "Hello, World!" on the screen. While it may seem straightforward, this program encompasses key programming concepts like input/output and syntax, making it an ideal starting point for beginners who want to learn C Programming.


Working of the C Hello World Program.

To create a "Hello World" program in C, follow these simple steps:


Step 1: Setting up the Development Environment.

Before you begin, ensure you have a C compiler installed on your system. Popular choices include GCC (GNU Compiler Collection) for Linux and MinGW for Windows. Once you have the compiler installed, you're ready to start coding.


Step 2: Writing the C Code.

Open a text editor and create a new file. Begin by including the standard input/output header file "stdio.h," which provides functions for input and output operations. Within the main function, add the printf function to display the "Hello, World!" message on the screen.


C Example:

#include <stdio.h>

int main() {

    printf("Hello, World!");

    return 0;
}
Output:
Hello, World!

Step 4: Save and Compile the Program.

Save the file with a .c extension, such as hello_world.c. Open your terminal or command prompt, navigate to the file's location, and compile the program using the C compiler:

For GCC on Linux:
gcc -o hello_world hello_world.c

For MinGW on Windows:
gcc -o hello_world.exe hello_world.c

Step 5: Running the Program.

After successful compilation, you will see an executable file in the same directory as your C file. 
Run the program by typing the following command:

For Linux:
./hello_world

For Windows:
hello_world.exe

Congratulations! You have just created and executed your first C Hello World program. I hope you now understand the basic working of the C Program and how to execute it. 


⚡ Please share your valuable feedback and suggestion in the comment section below or you can send us an email on our offical email id ✉ algolesson@gmail.com. You can also support our work by buying a cup of coffee ☕ for us.

Similar Posts

No comments:

Post a Comment


CLOSE ADS
CLOSE ADS