Writing & Executing First C Program
💻 Writing & Executing First C Program (Hello World)
Let’s create your first C program step-by-step 🎉
🔹 Step 1: Open IDE
Open your compiler/IDE like
👉 Dev-C++ (or any other you installed)
🔹 Step 2: Write the Program ✍️
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
🔹 Step 3: Understand the Code 🧠
-
#include <stdio.h>→ For input/output functions -
int main()→ Program starts here -
printf()→ Prints message on screen -
return 0;→ Ends program successfully
🔹 Step 4: Save the File 💾
- Click File → Save As
-
File name:
hello.c
👉 Important: Use.cextension
🔹 Step 5: Compile the Program ⚙️
- Click Execute → Compile
- Or press F9
👉 This checks for errors
🔹 Step 6: Run the Program ▶️
- Click Execute → Run
- Or press F10
🔹 Step 7: Output 🎉
Hello, World!
🔹 One Shortcut 🚀
👉 Press F11 → Compile + Run together
🔹 Common Errors ⚠️
-
Missing
;(semicolon) -
Wrong spelling (
printf) -
File not saved as
.c
🔹 Summary 📝
- Write code ✍️
-
Save as
.c💾 - Compile ⚙️
- Run ▶️
- See output 🎉
Comments
Post a Comment