0
0
Cprogramming~15 mins

Writing first C program - Mini Project: Build & Apply

Choose your learning style9 modes available
Writing first C program
📖 Scenario: You want to create a simple C program that prints a friendly greeting message on the screen. This is like writing a short note to say hello to your computer.
🎯 Goal: Build a C program that prints the message Hello, World! to the console.
📋 What You'll Learn
Create a main function
Include the stdio.h header
Use printf to display the message
Return 0 from main
💡 Why This Matters
🌍 Real World
Printing messages is the first step in learning how to communicate with a computer using code.
💼 Career
Understanding basic program structure and output is essential for all software development jobs.
Progress0 / 4 steps
1
Include the standard input-output header
Write the line #include <stdio.h> at the top of your program to include the standard input-output library.
C
Need a hint?

This line tells the computer to include the code needed to print messages on the screen.

2
Create the main function
Write the line int main() followed by an opening curly brace { to start the main function.
C
Need a hint?

The main function is where your program starts running.

3
Print the greeting message
Inside the main function, write the line printf("Hello, World!\n"); to print the greeting message.
C
Need a hint?

The \n adds a new line after the message.

4
Close the main function and return 0
Add the line return 0; and then a closing curly brace } to end the main function.
C
Need a hint?

Returning 0 means the program finished successfully.