C Programming for Beginners: Writing Your First Hello World Program in C in 2023

Article by: Manish Methani

Last Updated: November 8, 2021 at 2:04pm IST
2 min 39 sec

C is a popular and widely used programming language that is commonly used for system programming and low-level programming. Writing a Hello World program is a great way to get started with learning the basics of C programming.

Here's a step-by-step tutorial to help you write your first Hello World program in C:

Step 1: Set up your development environment

Before you start writing your C program, you need to set up your development environment. You'll need a text editor to write your code, and a compiler to compile and run your program.

There are many text editors and compilers available for C programming, but some popular choices include Visual Studio Code, Sublime Text, and GCC.

Step 2: Write your code

Once you have your development environment set up, you're ready to start writing your program. Open your text editor and create a new file. In this file, type the following code:

#include 

int main() {
printf("Hello, World!");
   return 0;
}

This code uses the printf function to print the text "Hello, World!" to the console.

Step 3: Compile and run your program

Save your file with the name hello.c. Now, you arere ready to compile and run your program. Open a terminal window and navigate to the directory where you saved your file.

Type the following command to compile your program:

gcc -o hello hello.c

This command compiles your program and creates an executable file called hello.

Now, type the following command to run your program:

./hello

This command executes your program and displays the output "Hello, World!" on the console.

Congratulations! You have successfully written and run your first program in C.

In conclusion, writing a Hello World program in C is a simple yet powerful way to get started with programming in C. By following this step-by-step tutorial, you have learned how to set up your development environment, write C code, and compile and run your program. With this basic understanding of C programming, you are ready to start exploring the many other powerful features and capabilities of this popular programming language.

Simplified Coding for Beginners.








Download the Codzify
Mobile App


Mobile App Development, Web App Development, Programming Languages, Latest Tech News & lot more.

Codzify Mobile App

A self-paced learning Courses Created by an Engineer
For Engineers.

Premium

The Complete Angular Course

Instructor: Manish Methani

Explore Curriculum
Free

C Programming for Absolute Beginners

Instructor: Manish Methani

Start Watching
Premium

Flutter Mobile App Development Course

Instructor: Manish Methani

Explore Curriculum
Free

Learn HTML, CSS & Bootstrap

Instructor: Manish Methani

Start Watching

Test your skills with these expert-led curated
Mock Tests.

C Programming Test

Test your C Programming skills with this comprehensive mock test on C Programming.

Take Test

Flutter Test

Solve most asked Interview Questions on Flutter and Test your foundational skills in flutter.

Take Test

GATE(CSE) Operating Systems

Solve most asked GATE Questions in Operating Systems and test your Gate Score.

Take Test

HTML,CSS Test

This is a mock test designed to help you assess your knowledge and skills in HTML and CSS.

Take Test

(GATE CSE) Data Structures & Algorithms Test

Solve most asked GATE Questions in Data Structures and Algorithms and test your Gate Score.

Take Test
include_once 'codzify-footer.php'; ?>