2 Sams Teach Yourself C in 21 Days
Example 1
#include <stdio.h>
int main( void )
{
printf( “This is an example of something printed!”);
}
Example 1 Output
This is an example of something printed!
Example 2
printf( “This prints a character, %c\na number, %d\na floating point,
%f”, ‘z’, 123, 456.789 );
Example 2 Output
This prints a character, z
a number, 123
a floating point, 456.789
Another feature of this book is DO/DON’T boxes, which give you pointers on what to do
and what not to do.
,
,
DOread the rest of this section. It
explains the Workshop sections that
appear at the end of each day.
DON’Tskip any of the quiz questions or
exercises. If you can finish the day’s
workshop, you’re ready to move on to
new material.
DO DON’T
You’ll encounter Tip, Note, and Caution boxes as well. Tips provide useful shortcuts and
techniques for working with C. Notes provide special details that enhance the explana-
tions of C concepts. Cautions help you avoid potential problems.
Numerous sample programs illustrate C’s features and concepts so that you can apply
them in your own programs. Each program’s discussion is divided into three compo-
nents: the program itself, the input required and the output generated by it, and a line-by-
line analysis of how the program works. These components are indicated by special
icons.
Each day ends with a Q&A section containing answers to common questions relating to
that day’s material. There is also a Workshop at the end of each day. It contains quiz
questions and exercises. The quiz tests your knowledge of the concepts presented on that
01 448201x-Intro 8/13/02 11:21 AM Page 2