🟢 Beginner  ·  Lesson 03

Environment Setup

C Programs लिखने के लिए क्या चाहिए?

C programs लिखने और run करने के लिए आपको दो चीज़ें चाहिए:

  1. Text Editor या IDE — जहाँ आप C code लिखते हैं (source code)
  2. C Compiler — आपके C code को machine language (executable) में convert करता है

सबसे popular C compiler है GCC (GNU Compiler Collection) — यह free, open-source है और सभी platforms पर available है।

✅ सबसे Quick Option – बिना Installation के

https://www.onlinegdb.com/online_c_compiler पर जाएं — C language select करें और code directly browser में run करें। Practice के लिए perfect।

Windows पर Setup (Dev-C++)

Method 1: Dev-C++ (Beginners के लिए सबसे आसान)

  1. https://sourceforge.net/projects/orwelldevcpp/ पर जाएं
  2. Download पर click करें और installer run करें
  3. Installation के दौरान सभी defaults accept करें
  4. Dev-C++ खोलें → File → New → Source File
  5. C code लिखें → hello.c नाम से Save करें
  6. F9 press करें या Execute → Compile & Run click करें

Method 2: Code::Blocks (Recommended)

  1. http://www.codeblocks.org/downloads/binaries/ पर जाएं
  2. Download: codeblocks-XX.XXmingw-setup.exe (जिसके नाम में mingw हो — इसमें compiler included है)
  3. Installer run करें → Full installation select करें
  4. Code::Blocks खोलें → File → New → Empty File → hello.c नाम से Save करें
  5. Code लिखें → F9 press करके Build and Run करें

Linux पर Setup (Terminal + GCC)

Terminal
gcc --version           # Check if GCC installed है
sudo apt install gcc    # Install करें (Ubuntu/Debian)
gcc hello.c -o hello    # Compile करें
./hello                 # Run करें

VS Code Setup

  1. https://code.visualstudio.com/ से VS Code download करें
  2. Extensions में C/C++ by Microsoft install करें
  3. Windows पर MinGW-w64 install करके PATH में add करें
  4. Terminal में: gcc filename.c -o output

पहला Compilation – Step by Step

hello.c
#include <stdio.h>

int main() {
    printf("Namaste Duniya!\n");
    return 0;
}
Namaste Duniya!

Compilation process के 4 stages होते हैं:

  1. Preprocessing#include और #define handle करता है
  2. Compilation — C को assembly code में convert करता है
  3. Assembly — assembly को machine code (object file) में convert करता है
  4. Linking — libraries को link करके final executable बनाता है

सारांश

  • C लिखने के लिए compiler (GCC) और editor/IDE चाहिए
  • Beginners: Windows पर Dev-C++ या Code::Blocks use करें
  • Online practice: OnlineGDB.com (कोई installation नहीं)
  • Professional: VS Code + GCC
  • Compile command: gcc filename.c -o outputname

अक्सर पूछे जाने वाले प्रश्न (FAQ)

Windows पर C कैसे setup करूँ?
सबसे आसान तरीका MinGW जैसा compiler (जो gcc देता है) या Code::Blocks जैसा all-in-one IDE install करना है जो compiler साथ लाता है। Install के बाद आप अपना code .c file में लिखते हैं और terminal या IDE के build button से compile करते हैं।
Beginner को C के लिए कौन-सा compiler इस्तेमाल करना चाहिए?
gcc सबसे लोकप्रिय मुफ़्त C compiler है और Windows, Linux तथा macOS पर काम करता है। Beginners अक्सर इसे VS Code जैसे editor या Code::Blocks जैसे IDE के ज़रिए इस्तेमाल करते हैं, जो compile-और-run कदम एक click में संभालते हैं।
C programs लिखने के लिए क्या कुछ install करना ज़रूरी है?
अपने computer पर C compile और run करने को आपको gcc जैसा compiler चाहिए। अगर आप बस जल्दी C आज़माना चाहते हैं, online compilers आपको बिना कुछ install किए browser में code लिखने-चलाने देते हैं, जो पहले basics सीखने के लिए बढ़िया है।
Terminal से C program कैसे compile और run करें?
अपना code hello.c जैसी file में सहेजें, फिर gcc hello.c -o hello चलाकर उसे hello नामक program में compile करें, और उसे Linux या macOS पर ./hello से, या Windows पर hello.exe से चलाएँ।
क्या C programming के लिए VS Code अच्छा है?
हाँ। VS Code एक मुफ़्त, हल्का editor है जो C/C++ extension और gcc जैसे compiler के साथ मिलकर C लिखने, compile करने और debug करने का आरामदायक setup देता है। यह beginners और professionals दोनों की लोकप्रिय पसंद है।
← Back to C Tutorial
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

💻 लाइव कोड एडिटर

इस पेज के प्रोग्राम यहीं तैयार हैं — चलाएँ, बदलें और सीखें। कुछ भी इंस्टॉल किए बिना।
OneCompiler द्वारा संचालित। कोड एडिटर में अपने आप आ जाता है — Run दबाकर आउटपुट देखें। अगर एडिटर न खुले तो नए टैब में खोलें.