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 Integrated development environment
1.7 Computer tour
1.8 Language history
1.9 Problem solving
1.10 Why programming
1.11 Why whitespace matters
1.12 C example: Salary calculation
1.13 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 Detecting equal values with branches
3.3 Detecting ranges with branches (general)
3.4 Detecting ranges with branches
3.5 Detecting ranges using logical operators
3.6 Detecting ranges with gaps
3.7 Detecting multiple features with branches
3.8 Common branching errors
3.9 Example: Toll calculation
3.10 Oder of evaluation
3.11 Switch statements
3.12 Boolean data type
3.13 String comparisons
3.14 String access operations
3.15 Character operations
3.16 Conditional expressions
3.17 Floating-point comparison
3.18 Short circuit evaluation
3.19 C example: Salary calculation with branches
3.20 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 Print functions
6.3 Reasons for defining functions
6.4 Writing mathematical functions
6.5 Functions with branches
6.6 Functions with loops
6.7 Unit testing (functions)
6.8 How functions work
6.9 Functions: Common errors
6.10 Pass by pointer
6.11 Functions with array parameters
6.12 Functions with C string parameters
6.13 Functions with array parameters: Common errors
6.14 Scope of variable/function definitions
6.15 Parameter error checking
6.16 Preprocessor and include
6.17 Separate files
6.18 C example: Salary calculation with functions
6.19 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 Compiling and running a program using a command-line interface
12.6 Modular compilation
12.7 Makefiles
12.8 Binary file I/O
12.9 Engineering examples using functions
12.10 Command-line arguments and files
12.11 Additional practice: Output art
12.12 Additional practice: Grade calculation
12.13 Additional practice: Abbreviation decoder
12.14 Additional practice: Dice statistics
12.15 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
  • 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.

zyBooks programming environment

See the advanced zyLabs capabilities:

Authors

Frank Vahid
Computer Science PhD, Univ. of California, Irvine / zyBooks Co-Founder

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

Instructors: Interested in evaluating this zyBook for your class?