Skip to content

    Read more about How to Think Like a Computer Scientist: C Version

    How to Think Like a Computer Scientist: C Version

    (2 reviews)

    Allen B. Downey

    Thomas Scheffler

    Copyright Year:

    Publisher: Green Tea Press

    Language: English

    Formats Available

    Conditions of Use

    Attribution-NonCommercial Attribution-NonCommercial
    CC BY-NC

    Reviews

    Learn more about reviews.

    Reviewed by Carter Tiernan, Assoc. Prof. of Instruction, University of Texas at Arlington on 3/2/20

    Very good coverage of all beginning topics in C. I might have chosen to emphasize control structures a little more as they appear in the text but they are well integrated and used in a meaningful way. read more

    Reviewed by Ivo Georgiev, Affiliate Faculty, Metropolitan State University of Denver on 7/25/19

    The book is intended as a very first introduction into computer science and programming. As such, its content is well-balanced in comprehensiveness and conciseness. A programming book should not distract with verbose text and this book strikes a... read more

    Table of Contents

    Chapter 1: The way of the program

    • 1.1 What is a programming language?
    • 1.2 What is a program?
    • 1.3 What is debugging?
    • 1.4 Formal and natural language
    • 1.5 The first program
    • 1.6 Glossary
    • 1.7 Exercises

    Chapter 2: Variables and types

    • 2.1 More output
    • 2.2 Values
    • 2.3 Variables
    • 2.4 Assignment
    • 2.5 Outputting variables
    • 2.6 Keywords
    • 2.7 Operators
    • 2.8 Order of operations
    • 2.9 Operators for characters
    • 2.10 Composition
    • 2.11 Glossary
    • 2.12 Exercises

    Chapter 3: Function

    • 3.1 Floating-point
    • 3.2 Constants
    • 3.3 Converting from double to int
    • 3.4 Math functions
    • 3.5 Composition
    • 3.6 Adding new functions
    • 3.7 Definitions and uses
    • 3.8 Programs with multiple functions
    • 3.9 Parameters and arguments
    • 3.10 Parameters and variables are local
    • 3.11 Functions with multiple parameters
    • 3.12 Functions with results
    • 3.13 Glossary
    • 3.14 Exercises

    Chapter 4: Conditionals and recursion

    • 4.1 Conditional execution
    • 4.2 The modulus operator
    • 4.3 Alternative execution
    • 4.4 Chained conditionals
    • 4.5 Nested conditionals
    • 4.6 The return statement
    • 4.7 Recursion
    • 4.8 Infinite recursion
    • 4.9 Stack diagrams for recursive functions
    • 4.10 Glossary
    • 4.11 Exercises

    Chapter 5: Fruitful functions

    • 5.1 Return values
    • 5.2 Program development
    • 5.3 Composition
    • 5.4 Boolean values
    • 5.5 Boolean varaiables
    • 5.6 Logical operators
    • 5.7 Bool functions
    • 5.8 Returning from main()
    • 5.9 Glossary
    • 5.10 Exercises

    Chapter 6: Iteration

    • 6.1 Multiple assignment
    • 6.2 Iteration
    • 6.3 The while statement
    • 6.4 Tables
    • 6.5 Two-dimensional tables
    • 6.6 Encapsulation and generalization
    • 6.7 Functions
    • 6.8 More encapsulation
    • 6.9 Local varaiables
    • 6.10 More generalization
    • 6.11 Glossary
    • 6.12 Exercises

    Chapter 7: Arrays

    • 7.1 Increment and decrement operators
    • 7.2 Accessing elements
    • 7.3 Copying arrays
    • 7.4 for loops
    • 7.5 Array length
    • 7.6 Random numbers
    • 7.7 Statistics
    • 7.8 Array of random numbers
    • 7.9 Passing an array to a function
    • 7.10 Counting
    • 7.11 Checking the other values
    • 7.12 A histogram
    • 7.13 A single-pass solution
    • 7.14 Random seeds
    • 7.15 Glossary
    • 7.16 Exercises

    Chapter 8: Strings and things

    • 8.1 Containers for strings
    • 8.2 String variables
    • 8.3 Extracting characters from a string
    • 8.4 Length
    • 8.5 Traversal
    • 8.6 Finding a character in a string
    • 8.7 Pointers and Addresses
    • 8.8 String concatenation
    • 8.9 Assigning new values to string variables
    • 8.10 strings are not comparable
    • 8.11 Character classification
    • 8.12 Getting user input
    • 8.13 Glossary
    • 8.14 Exercises

    Chapter 9: Structures

    • 9.1 Compound values
    • 9.2 Point objects
    • 9.3 Accessing member variables
    • 9.4 Operations on structures
    • 9.5 Structures as parameters
    • 9.6 Call by value
    • 9.7 Call by reference
    • 9.8 Rectangles
    • 9.9 Structures as return types
    • 9.10 Passing other types by reference
    • 9.11 Glossary
    • 9.12 Exercises

    Ancillary Material

    Submit ancillary resource

    About the Book

    The goal of this book is to teach you to think like a computer scientist. I like the way computer scientists think because they combine some of the best features of Mathematics, Engineering, and Natural Science. Like mathematicians, computer scientists use formal languages to denote ideas (specifically computations). Like engineers, they design things, assembling components into systems and evaluating trade offs among alternatives. Like scientists, they observe the behavior of complex systems, form hypotheses, and test predictions.The single most important skill for a computer scientist is problem-solving. By that I mean the ability to formulate problems, think creatively about solutions, and express a solution clearly and accurately. As it turns out, the process of learning to program is an excellent opportunity to practice problem-solving skills. That’s why this chapter is called “The way of the program.”

    About the Contributors

    Author

    Allen B. Downey is an American computer scientist, professor of computer science at the Franklin W. Olin College of Engineering and writer of free textbooks.

    Downey received in 1989 his BS and in 1990 his MA, both in Civil Engineering from the Massachusetts Institute of Technology, and his PhD in Computer Science from the University of California at Berkeley in 1997.

    He started his career as Research Fellow in the San Diego Supercomputer Center in 1995. In 1997 he became Assistant Professor of Computer Science at Colby College, and in 2000 at Wellesley College. He was Research Fellow at Boston University in 2002 and Professor of Computer Science at the Franklin W. Olin College of Engineering since 2003. In 2009-2010 he was also Visiting Scientist at Google Inc.

    Translator

    Prof Thomas Scheffler, translated the book "How to Think Like a Computer Scientist: C++ Version" to C.

    Contribute to this Page

    Suggest an edit to this book record