Programming in C
Roman Lysecky | Frank Vahid
zyBooks 2017

Table of Contents

1. Introduction to C
1.1 Programming
1.2 A first program
1.3 Basic output
1.4 Basic input
1.5 Comments and whitespace
1.6 Errors and warnings
1.7 Computers and programs
1.8 Computer tour
1.9 Language history
1.10 Problem solving
1.11 C example: Salary Calculation
1.12 C example: Married-couple names

2. Variables / Assignments
2.1 Variables (int)
2.2 Assignments
2.3 Identifiers
2.4 Arithmetic expressions (int)
2.5 Floating-point numbers (double)
2.6 Constant variables
2.7 Using math functions
2.8 Type conversions
2.9 Binary
2.10 Characters
2.11 String basics
2.12 Integer overflow
2.13 Numeric data types
2.14 Unsigned
2.15 Random numbers
2.16 The printf and scanf functions
2.17 Debugging
2.18 Style guidelines
2.19 C example: Salary calculation with variables
2.20 C example: Married-couple names with variables

3. Branches
3.1 If-else
3.2 Relational and equality operators
3.3 Multiple if-else branches
3.4 Logical operators
3.5 Switch statements
3.6 Boolean data types
3.7 String comparisons
3.8 String access operations
3.9 Character operations
3.10 Conditional expressions
3.11 Floating-point comparison
3.12 Short circuit evaluation
3.13 C example: Salary calculation with branches
3.14 C example: Search for name using branches

4. Loops
4.1 Loops
4.2 While loops
4.3 More while examples
4.4 Counting
4.5 For loops
4.6 Nested loops
4.7 Developing programs incrementally
4.8 Break and continue
4.9 Variable name scope
4.10 Enumerations
4.11 C example: Salary calculation with loops
4.12 C example: Domain name validation with loops

5. Arrays
5.1 Array concept
5.2 Arrays
5.3 Array iteration drill
5.4 Iterating through arrays
5.5 Multiple arrays
5.6 Swapping two variables
5.7 Loop-modifying or copying/comparing arrays
5.8 Debugging example: Reversing an array
5.9 Two-dimensional arrays
5.10 Char arrays / C strings
5.11 String library functions
5.12 Char library functions: ctype
5.13 Arrays and strings
5.14 C example: Salary calculation with arrays
5.15 C example: Domain name validation with arrays

6. User-Defined Functions
6.1 User-defined function basics
6.2 Parameters
6.3 Return
6.4 Reasons for defining functions
6.5 Functions with branches/loops
6.6 Unit testing (functions)
6.7 How functions work
6.8 Functions: Common errors
6.9 Pass by pointer
6.10 Functions with array parameters
6.11 Functions with C string parameters
6.12 Functions with array parameters: Common errors
6.13 Scope of variable/function definitions
6.14 Preprocessor and include
6.15 Separate files
6.16 C example: Salary calculation with functions
6.17 C example: Domain name validation with functions

7. Structs
7.1 Grouping data: struct
7.2 Structs and functions
7.3 Structs and arrays
7.4 Structs, arrays, and functions: A seat reservation example
7.5 Separate files for structs

8. Pointers
8.1 Why pointers: Pass by pointer example
8.2 Pointer basics
8.3 The malloc and free functions
8.4 Pointers with structs
8.5 String functions with pointers
8.6 The malloc function for arrays and strings
8.7 The realloc function
8.8 Vector ADT
8.9 Why pointers: A list example
8.10 A first linked list
8.11 Memory regions: Heap/Stack
8.12 Memory leaks
8.13 C example: Employee list using vector ADT

9. Input / Output
9.1 The stdout file pointer
9.2 The stdin file pointer
9.3 Output formatting
9.4 Input parsing
9.5 File input and output

10. Recursion
10.1 Recursion: Introduction
10.2 Recursive functions
10.3 Recursive algorithm: Search
10.4 Adding output statements for debugging
10.5 Creating a recursive function
10.6 Recursive math functions
10.7 Recursive exploration of all possibilities
10.8 Stack overflow
10.9 C example: Recursively output permutations

11. Additional Material
11.1 Do-while loops
11.2 Engineering examples
11.3 Command-line arguments
11.4 The #define directive
11.5 Modular compilation
11.6 Makefiles
11.7 Binary file I/O
11.8 Engineering examples using functions
11.9 Command-line arguments and files
11.10 Additional practice: Output art
11.11 Additional practice: Grade calculation
11.12 Additional practice: Health data
11.13 Additional practice: Tweet decoder
11.14 Additional practice: Dice statistics
11.15 zyBooks built-in programming window