Introduction
As you can guess from the title, this book is set up so that you can teach yourself the C
programming language in 21 days. Despite stiff competition from languages such as
C++, Java, and C#, C remains the language of choice for people who are just learning
programming. For reasons we detail on Day 1, you can’t go wrong in selecting C as your
programming language.
We think you’ve made a wise decision selecting this book as your means of learning C.
Although there are many books on C, we believe this book presents C in the most logical
and easy-to-learn sequence. The fact that the five previous editions have been on best-
seller lists indicates that readers agree with us! We designed this book for you to work
through the chapters in order on a daily basis. We don’t assume any previous program-
ming experience on your part, although experience with another language, such as
BASIC, might help you learn faster. We also make no assumptions about your computer
or compiler; this book concentrates on teaching the C language, regardless of whether
you’re using a PC, a Mac, or a UNIX system.
As an added bonus, we have included seven extra days in this book. The added bonus
days provide you with a primer on object-oriented programming and an introduction to
the most popular object-oriented languages, C++, Java and C#. Although these extra
chapters won’t teach you everything about these topics, they will get you started.
This Book’s Special Features ................................................................................
This book contains some special features to aid you on your path to C enlightenment.
Syntax boxes show you how to use specific C concepts. Each box provides concrete
examples and a full explanation of the C command or concept. To get a feel for the style
of the syntax boxes, look at the following example. (Don’t try to understand the material;
you haven’t even reached Day 1!)
#include <stdio.h>
printf( format-string[,arguments,...]);
printf()is a function that accepts a series of arguments,each applying to a conversion
specifier in the given format string. It prints the formatted information to the standard
output device, usually the display screen. When using printf(), you need to include the
standard input/output header file, stdio.h.
Theformat-stringis required; however,argumentsare optional. For each argument,
there must be a conversion specifier. The format string can also contain escape
sequences. The following are examples of calls to printf()and their output:
,
S
YNTAX
,
01 448201x-Intro 8/13/02 11:21 AM Page 1