Concepts of Programming Language: Source Code, Object Code, executable code

आप इंसानों के लिए source code लिखते हैं (.c), compiler उसे object code में translate करता है (.obj), और linker उसे executable बना देता है (.exe), वही एक रूप जो CPU सच में चला सकता है।

9 min read · 9 cards · 2 checks

Read in: English · हिन्दी · ગુજરાતી


Theory

वह program जिसे आप बड़ा करने वाले हैं

इस subject का एक hero है: marks program। आज वह एक student के बारे में बस एक line print कर सकता है। Syllabus खत्म होते-होते वह पूरी class store करेगा, grades निकालेगा, toppers sort करेगा, और साफ-सुथरे functions में रहेगा।

पर पहले एक problem सुलझानी है। आप उसे C में लिखेंगे, जो mathematical English जैसी दिखती है। और BCA103 से आप जानते हैं कि CPU सिर्फ binary machine instructions चलाता है।

किसी को translate करना पड़ेगा। वह कौन है, और रास्ते में आपका program कौन से 3 रूप लेता है, यही आज का lesson है।

Theory

Recipe, कटी-मपी tray, परोसी हुई dish

आपकी handwriting वाला recipe card इंसानों के लिए है: भाषा जानने वाला कोई भी उसे पढ़े, follow करे, सुधारे। यही source code है। फिर kitchen उसे कटी, मापी हुई ingredients की trays में prep कर देता है, खाने लायक नहीं, पर machine-ready: object code। आख़िर में counter trays और standard sides (जो bread-chutney कोई दोबारा नहीं बनाता) जोड़कर dish परोसता है: executable। खाई सिर्फ dish जा सकती है; चलाया सिर्फ executable जा सकता है।

Practical

marks.c, marks program का पहला दिन

#include <stdio.h>

int main() {
    printf("Riya scored 78 marks\n");
    return 0;
}

This example runs in Gri-Learn on the web, where you can edit it and see the output.

Theory

तीनों रूप, ठीक-ठीक

ऊपर वाली file सादा text है जिसे आप बोलकर पढ़ सकते हैं। अब उसका सफर देखिए:

marks.c → [compiler] → marks.obj → [linker] → marks.exe

  • Source code (marks.c): program वैसा जैसा इंसान लिखते-पढ़ते हैं।
  • Object code (marks.obj): compiler का machine-language translation, पर अधूरा: printf का code इसके अंदर नहीं है, बस एक note है कि "यहाँ printf चाहिए"।
  • Executable (marks.exe): linker आपके object code को library के बने-बनाए code (जैसे printf के) से जोड़ देता है। यही file CPU सीधे चलाता है।

Quiz

तीनों files में से CPU कौन सी सीधे चला सकता है?

  1. marks.exe, executable
  2. marks.c, source code
  3. marks.obj, object code
  4. तीनों बराबर चलती हैं
Show the answer

marks.exe, executable

सिर्फ executable पूरी machine language है जिसकी हर reference resolve हो चुकी है। Source इंसानी text है जिसे CPU नहीं समझता, और object code translate होकर भी अधूरा है, उसमें library code (printf) के छेद बाकी हैं। तीखा follow-up exam पूछता है: "object code क्यों नहीं चल सकता?": unresolved references।

Think first

सोचकर देखिए

आपका दोस्त Notepad में marks.exe खोलकर 78 को 95 करना चाहता है, और उसे सिर्फ garbage symbols दिखते हैं। क्यों? और उसे कौन सी file edit करनी चाहिए?

Show the answer

Executable binary machine instructions है, text नहीं: Notepad उन bytes को garbage की तरह दिखाता है। बदलाव source (marks.c) में होते हैं, इंसानों वाले रूप में, और फिर recompile करके नया .obj और .exe बनता है। रास्ता one-way है: source नीचे उतरकर executable बनता है; executable शराफत से वापस source नहीं बनता।

Watch out

Marks कहाँ कटते हैं

"Compiler program चलाता है" लिखना: वह सिर्फ translate करता है; चलाना CPU का काम है, बाद में। Object code को runnable कहना: वह machine language है पर unlinked, printf की body अभी गायब है। और pipeline के diagram में order मत बदलिए: पहले compiler, फिर linker। source → compiler → object → linker → executable वाला diagram exam में अपने अलग marks लाता है।

Theory

यह pipeline आप रोज़ देखेंगे

C के IDE में जब भी आप "compile and run" दबाएंगे, यही पूरी pipeline चलेगी: translate, link, execute। अगला lesson बताएगा कि C programs को साफ blocks में क्यों रखती है, और उसके बाद वाला tools के नाम रखेगा (editor, compiler, interpreter), तब तक नक्शा आपके पास होगा। Marks program यहीं से बड़ा होना शुरू करता है, हर lesson में थोड़ा।

Summary

Key takeaways

  • Source code (.c): इंसानों के पढ़ने लायक text में program, C में लिखा।
  • Object code (.obj): compiler का machine translation, link होने तक अधूरा।
  • Executable (.exe): linker object + library code जोड़ता है; CPU बस यही चलाता है।
  • Pipeline: source → compiler → object → linker → executable।
  • Compiler translate करता है; चलाता कभी नहीं।
  • Memory hook: recipe, कटी-मपी tray, परोसी हुई dish।

Study this properly

This page is the lesson to read. In Gri-Learn the same topic is a graded deck: the self-checks are scored and your weak topics are tracked. Free to start.

Start this topic

Already have an account? Sign in

More from Introduction to C language

Gri-Learn · syllabus-mapped B.C.A. lessons in English, Hindi and Gujarati

Concepts of Programming Language: Source Code, Object Code, executable code · Computer Programming and Programming Methodology (CPPM) · Gri-Learn