CSS Computer Science (Optional) — Paper-I, Section-A, Topic II subtopic. Appeared as a past paper question (2016). Complements Program Development and Execution page.

The Full Pipeline: Source Code → Executable

  1. Source code (.c / .cpp) — human-written code
  2. Preprocessing — preprocessor directives resolved (#include, #define, macro expansion) → produces expanded source
  3. Compilation — compiler translates preprocessed source into assembly code
  4. Assembly — assembler converts assembly code into object code (machine code, .obj/.o), but not yet linked
  5. Linking — linker combines object code with required libraries (standard library, other object files) and resolves external references → produces the final executable (.exe)
  6. Loading — at run time, the OS loader loads the executable into memory and transfers control to start execution

Diagram (textual)

Source (.c)PreprocessorExpanded SourceCompilerAssembly (.s)AssemblerObject Code (.o)Linker (+ libraries) → Executable (.exe)LoaderRunning Program

Key Distinctions

Worked Example

Given a tiny C program:

#include <stdio.h>
#define PI 3.14
int main() {
    printf("%f", PI);
    return 0;
}
  1. Preprocessing: #include <stdio.h> is replaced with the contents of the stdio header; PI is textually replaced with 3.14 everywhere it appears
  2. Compilation: the expanded source is translated into assembly instructions for printf("%f", 3.14); return 0;
  3. Assembly: the assembler turns those assembly instructions into object code (hello.o) — machine code, but printf is only referenced, not yet resolved