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 typeint
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?
- Syntax Understanding – Naye programmers ko C language ka syntax samajhne me help karta hai.
- Setup Verification – Is program ko execute karke aap ye ensure kar sakte hain ki aapka compiler aur environment sahi se work kar raha hai.
- Build Foundation – Is chhote se code snippet ke through aapko C programming ke fundamental concepts samajhne me help milegi hai.3
Comments
Co
New Co
hello
<h1>hello</h1>
</p><h1>hello</h1>
<img src=x onerror=alert(1)>