• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 7 pages
Class notes

C Programming Comprehensive Lecture & Class Notes: Compilation Architecture, Memory Layout, Data Types, I/O & Operators

Document preview thumbnail
Preview 2 out of 7 pages

Comprehensive, university-grade C Programming lecture notes for Computer Science students. Covers the complete 4-stage compilation architecture, lexical tokens and identifier rules, primitive data types with IEEE-754 representation, buffered standard input/output mechanics, operator precedence, implicit and explicit type casting, and fully traced programs.

Content preview

LECTURE NOTES: C PROGRAMMING
FUNDAMENTALS & SYSTEM ARCHITECTURE
Discipline: Computer Science & Engineering | Module 01: Detailed Course Notes |
Standard: ISO/IEC 9899 (C11)




1. Historical Context & Architectural Design Philosophy
Developed by Dennis Ritchie at AT&T Bell Laboratories in 1972, the C programming
language was engineered to implement the UNIX operating system. C is classified as a
general-purpose, procedural, statically typed, compiled language that provides low-
level deterministic access to system memory while maintaining hardware portability.
Core Architectural Characteristics
Deterministic Memory Control: Supports direct manipulation of physical and virtual
memory addresses through pointers and explicit byte-level allocation.
Minimal Runtime Overhead: Lacks automatic garbage collection or runtime type
reflection, producing compact machine binaries suitable for operating system kernels,
device drivers, and embedded firmware.
Structured Procedural Paradigm: Enforces modular program decomposition via
functions, block-level lexical scoping, and structured control constructs.

2. The Four-Stage Compilation & Build Pipeline
Translating human-readable source code into an operating-system-executable binary
requires four sequential software tools invoked automatically by compiler drivers such as
gcc or clang :
±-----------------+ ±-----------------+ ±-----------------+ ±-----------------+
| Source File | | Expanded Code | | Assembly Code | | Object File |
| (main.c) | --> | (main.i) | --> | (main.s) | --> | (main.o) |
±-----------------+ ±-----------------+ ±-----------------+ ±-----------------+
||||
[1. Preprocessor] [2. Compiler] [3. Assembler] [4. Linker]
Expands macros & Syntax/semantic Translates ASM Resolves symbols &
header files checks -> ASM to machine code links libc -> .exe
Detailed Stage Breakdown
Stage I — Preprocessing ( .c .i ): The C Preprocessor ( cpp ) executes textual
transformations before syntax analysis begins. It strips all single-line ( // ) and multi-line
( /* */ ) comments, recursively inserts header file contents ( #include ), performs macro
text substitution ( #define ), and evaluates conditional compilation directives ( #ifdef ,

,#endif ).
Stage II — Compilation ( .i .s ): The compiler front-end performs lexical
tokenization, constructs an Abstract Syntax Tree (AST), enforces static type-checking
rules, and emits target-architecture-specific Assembly Language instructions (e.g., x86-
64 or ARM64).
Stage III — Assembly ( .s .o ): The Assembler ( as ) converts symbolic assembly
mnemonics into relocatable binary machine opcodes packaged inside an Object File (ELF
format on Linux, COFF/PE on Windows).
Stage IV — Linking ( .o Executable): The Linker ( ld ) merges multiple object files,
resolves external function references (such as printf ) against the C Standard Library
( libc ), and assigns final virtual memory addresses to generate the executable binary.

3. Lexical Elements: Tokens, Keywords & Identifiers
During lexical analysis, the compiler decomposes source text into six fundamental atomic
units known as Tokens:
Keywords: Reserved words with predefined syntactic meanings (32 in ANSI C89; 44 in
C11), such as int , return , const , volatile , sizeof , and struct .
Identifiers: User-defined names assigned to variables, functions, arrays, and structures.
Constants (Literals): Immutable data values hardcoded in source text (e.g., 42 ,
3.14159 , ‘Z’ , “System” ).
String Literals: Contiguous sequences of characters enclosed in double quotes,
automatically terminated by a null character ( ‘\0’ ).
Operators: Symbols instructing the CPU to perform arithmetic, logical, bitwise, or
memory operations.
Punctuators (Separators): Syntactic delimiters including semicolons ( ; ), braces ( {} ),
brackets ( [] ), and parentheses ( () ).


Lexical Rules for Valid Identifiers:

Must begin exclusively with an alphabetic character ( A–Z , a–z ) or an
underscore ( _ ).
Subsequent characters may comprise letters, digits ( 0–9 ), or underscores;
whitespace and special symbols ( @ , $ , - ) are strictly prohibited.
C is strictly case-sensitive: totalCount , TotalCount , and TOTALCOUNT
represent three distinct memory identifiers.


4. Primitive Data Types, Modifiers & Internal Representation
A variable declaration reserves a contiguous block of Random Access Memory (RAM) and
binds a symbolic name to its starting byte address.
4.1 Standard Data Types & Type Modifiers (64-Bit Architecture)
Type modifiers ( signed , unsigned , short , long ) alter the storage width and

Document information

Uploaded on
November 25, 2026
Number of pages
7
Written in
2026/2027
Type
Class notes
Professor(s)
General / standard curriculum
Contains
All classes
$7.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
0
Followers
0
Items
8
Last sold
-



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions