Hello World Program in C.

By Shakib Ansari | Date: Fri, Mar 21, 2025

Hello, World! Program in C.

Programming ki duniya me "Hello, World!" program likhna ek tradition hai. Ye kisi bhi New Programming Language ko seekhne ka pehla step hota hai. Is program ka basic purpose hota hai language ke syntex ko samjhna aur ye ensure karna ki aapka development environment sahi se setup ho chuka hai. Yeh naye programmers ke liye ek confidence booter bhi hota hai!

"Hello, World!" Program Example

C Code

#include<stdio.h> // Preprocessor Directive

int main(){  // Program Entry Point 
     printf("Hello, World!"); // Print Statement
     return 0; // Return To Function
}
Output: Hello, World!

Code Explanation (Step-by-Step)

1. #include<stdio.h> - Preprocessor Directive

#include ek preprocessor directive hai jo compiler ko batata hai ki ek header file ko include karna hai.

  • <stdio.h> ek standard input-output header file hai jo C language ke predefined functions ka collection hai.
  • Is header file me printf(), scanf() jaise functions hote hain jo program me input-output operations ke liye use hote hain.

2. int main() - Program Entry Point

main() function kisi bhi C program ka starting point hota hai.

  • int ka matlab hai ki yeh function ek integer value return karega.
  • Jab C program execute hota hai, execution main() function se start hoti hai.

3. { - Curly Brace (Scope Definition)

Curly brace { batata hai ki main function ka scope kahan se start ho raha hai.

4. printf("Hello, World!"); - Output Statement

printf() ek predefined function hai jo screen par output print karne ke liye use hota hai.

  • "Hello, World!" ek string hai jo console par print hogi.
  • ek escape sequence hai jo new line generate karta hai.

5. return 0; - Program Termination

  • return 0; batata hai ki program successfully execute ho chuka hai.
  • Kyunki hamne main() function ka return type int rakha hai, isliye hame ek integer value return karni hoti hai.
  • return 0; ka matlab hai successful execution, aur agar koi error hota to non-zero value return hoti.

6. } - Closing Curly Brace (End of Program)

Yeh curly brace } batata hai ki main function yahan khatam ho raha hai.

Why is "Hello, World!" Important?

  1. Syntax Understanding – Naye programmers ko C language ka syntax samajhne me help karta hai.
  2. Setup Verification – Is program ko execute karke aap ye ensure kar sakte hain ki aapka compiler aur environment sahi se work kar raha hai.
  3. Build Foundation – Is chhote se code snippet ke through aapko C programming ke fundamental concepts samajhne me help milegi hai.3
About the Author

Hi, I'm Shakib Ansari, Founder and CEO of BeyondMan. I'm a highly adaptive developer who quickly learns new programming languages and delivers innovative solutions with passion and precision.

Shakib Ansari
Programming

Comments


    User Avatar

    Co

    User Avatar

    New Co

    User Avatar

    hello

    User Avatar

    <h1>hello</h1>

    User Avatar

    </p><h1>hello</h1>

    User Avatar

    <img src=x onerror=alert(1)>