9 of the Best Free C Books
C is a general-purpose, procedural, portable, programming
language that is one of the most widely used languages. It was designed
to be compiled using a straightforward compiler, to provide low-level
access to
memory, to provide language constructs that map efficiently to machine
instructions, and to require minimal run-time support. Many programming
languages owe a considerable debt to C. It has become something of the
lingua franca in the programming world.
C is fairly simple to understand. It is a very flexible,
practical and compact language combined with an easy to read syntax.
Code written in C runs quickly, with easy access to the low level
facilities in the computer. Compiler directives make it possible to
produce a single version of a program compiled for different
architectures.
The C Programming Language by Brian Kernighan and Dennis
Ritchie is the complete guide to the ANSI standard C language
programming. The authors are the developers of C, and show readers show
to take advantage of all of the rich tapestry of C. The book is a
classic. However, there is a good range of books that teach C and are
available to download without charge. To cater for all tastes, we have
selected a diverse selection of informative books for C.
None of the books featured here could possibly replace
Kernighan and Ritchie's masterpiece. However, all of the texts here
come with our strongest recommendation. So get reading (and
downloading).
|
1. The C Book
|
 |
The C Book is designed for programmers who already have
some experience of using a modern high-level procedural programming
language. The book concentrates on the things that are special to C. In
particular, it is the way that C is used which is focused on.
Chapters include:
- An Introduction to C
- Variables and Arithmetic - introduces some of the
fundamentals of C, including keywords and identifiers, declaration of
variables, real types, integral types, expressions and arithmetic, and
constants
- Control of Flow and Logical Expressions -
looks at the various ways that the control of flow statements
can be used in a C program, including some statements that
have not been introduced so far. Control of flow, more logical
expressions, and strange operators
- Functions - the type of functions, recursion and
argument passing, and linkage
- Arrays and Pointers - arrays, pointers, character
handling, sizeof and storage allocation, pointers to functions,
expressions involving pointers, arrays, the & operator and
function declarations
- Structured Data Types - structures, unions,
bitfields, enums, qualifiers and derived types, and initialization
- The Preprocessor - how the preprocessor works, and
directives
- Specialized Areas of C - declarations, definitions
and accessibility, typedef, const and volatile, and sequence points
- Libraries - diagnostics, character handling,
localization, limits, mathematical functions, non-local jumps, signal
handling, variable numbers of arguments, input and output, formatted
I/O, character I/O, unformatted I/O, random access functions, general
utilities, string handling, and date and time
- Complete Programs in C - putting it all together,
arguments to main, interpreting program arguments, a pattern matching
program, and a more ambitious example
|
|
2. Learn C The Hard Way
|
|
Learn C The Hard Way fills in
the "beginning programmer" gap in the literature on the C Programming
language. It teaches good modern C programming
practices and avoid habits that lead to buffer overflows, security
defects, and other problems that even experienced programmers run
into.;
This book is designed for:
- Students who have read Learn
Python The Hard Way or Learn
Ruby The Hard Way
- Programmers with skill in one other "scripting"
language
- Programmers who need to relearn C
- Objective-C programmers who want better C skills
- People who like a challenge
The purpose of this book is to teach you how your
computer really works, and included in that is
how various data structures and algorithms function.
Chapters cover:
- Make is your Python now - a crash course in
make, and you will be learning to use it as you learn C
- Formatted Printing
- Introducing Valgrind - an instrumentation
framework for building dynamic analysis tools. There
are Valgrind tools that can automatically detect many memory management
and threading bugs, and profile your programs in detail
- The Structure of a C Program - break down a
simple C program line-by-line so you know how one is
structured
- Types of Variables - integers, floating point,
character, and string
- More Variables, Some Math - more things you can do
with variables by declaring various ints, floats, chars, and
doubles. Then use these variables in various math expressions
so you get introduced to C's basic math
- Sizes and Arrays - introduces a few
more concepts: sizeof and arrays
- Arrays of Strings, Looping - shows you that
C stores its strings simply as an array of bytes,
terminated with the '\0' (nul) byte
- While-Loop and Boolean Expressions - see how
a while-loop works
- If, Else-If, Else - something common in every
language is the if-statement, and C has one
- Switch Statement - some
code that we will break down to understand this concept of "jump tables"
- Writing and Using Functions - write
some functions and use some other functions
- Pointers Dreaded Pointers - demystifies pointers
- Structs and Pointers to them - learn how to
make a struct, point a pointer at them, and use them to make sense of
internal memory structures
- Heap and Stack Memory Allocation - create
an entire small program to manage a database
- Pointers to Functions - functions in C are actually
just pointers to a spot in the program where some code exists
- A Simple Object System - this exercise will build a
simple game where you kill a Minotaur in a small
little castle
- Zed's Awesome Debug Macros - a small set of
"debug macros" that implement a basic debugging and error handling
system for C
- Advanced Data Types and Flow Control - this exercise
will be a complete compendium of the available C data types and
flow control structures you can use
- The Stack, Scope, and Globals - learn about
scope by learning about how a stack data structure works, and then
feeding that concept back in to how modern C does scoping
- Meet Duff's Device - this exercise is a
brain teaser introducing a famous hack in C
- Input, Output, Files - use the functions
fscanf and fgets to build information about a person in a
structure. After this simple introduction to reading input, you will
get a full list of the functions that C has for I/O
- Variable Argument Functions - knowing how a
variable argument function works helps debug them and provides a
greater understanding of the computer
- Write a First Real Program - recreate a
piece of software, devpkg - a simple C program that installs other
software
- Creative and Defensive Programming - advanced
concepts and feature more talking than code
- Intermediate Makefiles - create a skeleton project
directory to use in building your C programs later
- Libraries and Linking - learning how C links things
helps you understand how your OS works and how it
runs your programs
- Automated Testing - used frequently in other
languages like Python and Ruby, but rarely used in C
- Debugging Code - Debug Printing vs GDB vs
Valgrind
- Double Linked Lists
- Linked List Algorithms - covers two
algorithms you can do on a linked list that involve
sorting
- Dynamic Array - an array that grows on its
own and has most of the same features as a linked list
- Sorting and Searching - covers four sorting
algorithms and one search algorithm
- Safer Strings - designed to get you into
using bstring from now on, why C's strings are
an incredibly bad idea, and then have you change the liblcthw
code to use bstring
- Hashmaps - Hash Maps (Hashmaps, Hashes, or
sometimes Dictionaries) are used frequently in
many dynamic programming for storing key/value data
- Hashmap Algorithms - implement three hash functions:
FNV-1a, Adler-32, and DJB Hash
- String Algorithms - gist of this algorithm
is that it calculates a "skip characters list" as a first operation,
then it uses this list to quickly scan through the string
- Binary Search Trees - the simplest tree
based data structure
- Using Cachegrind and Callgrind for Performance Tuning
- a quick course in using two tools for Valgrind
called callgrind and cachegrind
- Stacks and Queues - very simple data structures that
are really variants of the List data structure
- A Simple Statistics Engine - a simple
algorithm used for collecting summary statistics "online"
- Ring Buffer - useful when processing
asynchronous IO. They allow one side to receive data in random
intervals of random sizes, but feed cohesive chunks to another side in
set sizes or intervals
- A Simple TCP/IP Client - use the RingBuffer
to create a very simplistic little network testing tool called netclient
- Ternary Search Tree
- A Fast URL Router - use the TSTree to do
fast URL routing in web servers
- A Tiny Virtual Machine - implements a version of the
DCPU16 virtual machine using the algorthms created previously
|
|
3. Introduction to C Programming
|
 |
Introduction to C Programming is, as its name suggests,
a book for anyone completely new to programming and wants to learn C.
Chapters include:
- Computers
- Programming Languages - examines what is programming,
and a brief examination of programming languages
- C - looks at the advantages and disadvantages of C
- A First C Program - making C run, creating C
programs, what comprises a C program, the advantages and disadvantages
of C
- Variables - looks at types of variables, declaration
(int, float, char variables, missing types), variable declaration,
giving values to variables, and getting values into the program
- Writing a Program
- Functions - identified by name and can return a
single value. They act on parameters, which are used to pass
information into them. In our case we want a function which is given
the maximum and minimum values which something can have, and returns a
value in that range
- Arrays - explains why arrays are needed, array types
and sizes
- Switching - making multiple decisions
- Strings - computer jargon for lumps of text
- Structures - explains what is a structure, how they
work, pointers to structures, and defining your own types
- Files - when are files used, fopen and fclose, and
file functions
- Memory - fetching memory (malloc and free), and the
heap
- C and Large Programs - building large programs in C,
and the C pre-processor
|
Next
Section: 9 of the Best Free C Books - Part 2
This article is divided into three parts:
Part
1, Part
2, Part
3
Last Updated Saturday, March 16 2013 @ 07:15 PM EST |