Table of Contents

1.1 Programming (general)
1.2 Programming basics
1.3 Comments and whitespace
1.4 Errors and warnings
1.5 Computers and programs (general)
1.6 Computer tour
1.7 Language history
1.8 Problem solving
1.9 Why programming
1.10 Why whitespace matters
1.11 C example: Salary calculation
1.12 C example: Married-couple names

2.1 Variables and assignments (general)
2.2 Variables (int)
2.3 Identifiers
2.4 Arithmetic expressions (general)
2.5 Arithmetic expressions (int)
2.6 Example: Health data
2.7 Floating-point numbers (double)
2.8 Scientific notation for floating-point literals
2.9 Constant variables
2.10 Using math functions
2.11 Integer division and modulo
2.12 Type conversions
2.13 Binary
2.14 Characters
2.15 Strings
2.16 Integer overflow
2.17 Numeric data types
2.18 Unsigned
2.19 Random numbers
2.20 The printf and scanf functions
2.21 Debugging
2.22 Style guidelines
2.23 C example: Salary calculation with variables
2.24 C example: Married-couple names with variables

3.1 If-else branches (general)
3.2 If-else
3.3 More if-else
3.4 Equality and relational operators
3.5 Detecting ranges (general)
3.6 Detecting ranges with if-else statements
3.7 Logical operators
3.8 Order of evaluation
3.9 Example: Toll calculation
3.10 Switch statements
3.11 Boolean data type
3.12 String comparisons
3.13 String access operations
3.14 Character operations
3.15 Conditional expressions
3.16 Floating-point comparison
3.17 Short circuit evaluation
3.18 C example: Salary calculation with branches
3.29 C example: Search for name using branches

4.1 Loops (general)
4.2 While loops
4.3 More while examples
4.4 For loops
4.5 More for loop examples
4.6 Loops and strings
4.7 Nested loops
4.8 Developing programs incrementally
4.9 Break and continue
4.10 Variable name scope
4.11 Enumerations
4.12 C example: Salary calculation with loops
4.13 C example: Domain name validation with loops

5.1 Array/vector concept (general)
5.2 Vectors
5.3 Array iteration drill
5.4 Iterating through vectors
5.5 Multiple arrays
5.6 Swapping two variables (general)
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: Annual salary tax rate calculation with arrays
5.15 C example: Domain name validation with arrays

6.1 User-defined function basics
6.2 Return
6.3 Reasons for defining functions
6.4 Functions with branches/loops
6.5 Unit testing (functions)
6.6 How functions work
6.7 Functions: Common errors
6.8 Pass by pointer
6.9 Functions with array parameters
6.10 Functions with C string parameters
6.11 Functions with array parameters: Common errors
6.12 Scope of variable/function definitions
6.13 Parameter error checking
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.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.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.1 The stdout and stdin file pointers
9.2 Output formatting
9.3 Input parsing
9.4 File input and output

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.1 Searching and algorithms
11.2 Binary search
11.3 O notation
11.4 Algorithm analysis
11.5 Sorting: Introduction
11.6 Selection sort
11.7 Insertion sort
11.8 Quicksort
11.9 Merge sort

12.1 Do-while loops
12.2 Engineering examples
12.3 Command-line arguments
12.4 The #define directive
12.5 Modular compilation
12.6 Makefiles
17.7 Binary file I/O
18.8 Engineering examples using functions
12.9 Command-line arguments and files
12.10 Additional practice: Output art
12.11 Additional practice: Grade calculation
12.12 Additional practice: Tweet decoder
12.13 Additional practice: Dice statistics
12.14 zyBooks built-in programming window

Teach C with this hands-on, interactive zyBook, now updated with Advanced zyLabs

Programming in C is a comprehensive introduction to the foundational principles and practice of C programming, based on the latest standards.

  • Covers foundational constructs, like branches, loops and functions, and advanced topics, like inheritance, exceptions and plotting
  • Packed with over 600 interactive coding exercises and learning activities to help students master the material
  • Completely customizable so instructors can reorganize, edit and add their own learning content
  • Adopters have access to a test bank with questions for every chapter

What is a zyBook?


Programming in C is a web-native, interactive zyBook that helps students visualize concepts to learn faster and more effectively than with a traditional textbook. (Check out our research.)

Since 2012, over 1,700 academic institutions have adopted digital zyBooks to transform their STEM education.

The zyBooks Programming Environment

See the new Advanced zyLabs capabilities:

Authors

Frank Vahid
Professor of Computer Science and Engineering, Univ. of California, Riverside

Roman Lysecky
Professor of Electrical and Computer Engineering, Univ. of Arizona