Part I: The Foundation
Goal: Understand the syntax, basic data representation, and compilation. 1. Introduction to C
- The “Hello, World” Program: Structure of a C program (main function, headers).
- Compilation: How to compile and run (cc command).
- Variables & Arithmetic: Declarations, assignment, and basic arithmetic operators.
- Symbolic Constants: Using
#defineto avoid magic numbers. 2. Types, Operators, and Expressions - Data Types:
int,float,char,short,long,double. - Constants: Integer, floating-point, character, and string constants.
- Operators:
- Arithmetic (
+,-,*,/,%). - Relational and Logical (
>,==,&&,||). - Increment/Decrement (
++,--). - Bitwise Operators (
&,|,^,<<,>>).
- Arithmetic (
- Type Conversions: Implicit vs. Explicit (Casting).
Part II: Control Flow & Logic
Goal: Controlling the execution path of the code. 3. Decision Making
- Conditional Statements:
if,else,else-if. - Multi-way Selection: The
switchstatement. 4. Loops - Iteration:
while,for, anddo-whileloops. - Loop Control:
breakandcontinue.
Part III: Modular Programming
Goal: Organizing code into reusable blocks. 5. Functions
- Basics: Definitions, prototypes, and return values.
- Arguments: Call by Value mechanism.
- Scope Rules: External (global) vs. Automatic (local) variables.
- Recursion: Functions calling themselves. 6. The C Preprocessor
- File Inclusion:
#include. - Macro Substitution:
#definewith arguments. - Conditional Compilation:
#if,#ifdef.
Part IV: Memory & Data Management
Goal: Mastering C’s most powerful (and dangerous) features. 7. Arrays and Pointers
- Arrays: Declaration, initialization, and indexing.
- Pointers Basics: Addresses (
&), Dereferencing (*). - Pointer Arithmetic: Traversing arrays with pointers.
- Character Arrays: Strings as arrays of characters.
- Command-line Arguments: Handling
argcandargv. 8. Dynamic Memory (from Standard Library) - Storage Management:
malloc,calloc, andfree.
Part V: User-Defined Types
Goal: Creating complex data structures. 9. Structures
- Basics: Defining
struct, member access (.). - Structures and Pointers: The arrow operator (
->). - Arrays of Structures: Creating tables.
- Typedef: Creating new type names. 10. Unions & Bit-fields
- Unions: Storing different types in the same memory.
- Bit-fields: Accessing specific bits within a word.
Part VI: Interaction & System Interface
Goal: Communicating with files and the operating system. 11. Input and Output
- Standard I/O:
printf,scanf,getchar,putchar. - File I/O:
fopen,fclose,getc,putc. 12. The UNIX System Interface - Low-Level I/O: File descriptors,
read,write. - File Operations:
open,creat,close,unlink.
Why this order?
- Consolidates “Intro” material: It takes the concepts from Chapter 1 (Tutorial) and moves them into their specific technical chapters (e.g., Arrays are moved from Ch 1 to the Pointers/Arrays module).
- Logical Progression: It moves from Syntax → Logic → Structure → Memory → Data → System.
- Delayed Complexity: It pushes “Pointers” (the hardest topic) to the middle, after the audience understands basic variables and memory scope.