A Book On C - 4th - Ed05
A Book On C - 4th - Ed05
trademarks, Where those designatious appear in this book, and we were aware of a trademark claim, the
designations have been printed in initial capital letters or in all capitals.
The author and publisher have taken care in the preparation of this book, but make no expressed or
implied warranty of any kind and assume no responsibility for errors or omissions. No liability is
assumed for incidental or consequential damages in connection with or arising out of the use of the
information or programs contained herein.
The publisher offers discounts on this book when ordered in quantity for special sales. For more informa-
tion, please contact: For our Parents
Pearson Education Corporate Sales Division
201 W. 103rd Street
Indianapolis, IN 46290
(800) 428-5331
corpsales@pearsoned.com
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or
transmitted, in any form, or by any means, electronic, mechanical, photocopying, recording, or other-
wise, without the prior consent of the publisher. Printed in the United States of America. Published
simultaneously in Canada.
Preface xvii
Chapter 0
Starting from Zero 1
0.1 Why C? 2
0.2 ANSI C Standard 3
0.3 From C to C++ 3
0.4 From C and C++ to Java 4
Chapter 1
An Overview of C 5
1.1 Programming and Preparation 5
1.2 Program Output 6
1.3 Variables, Expressions, and Assignment 10
1.4 The Use of #defi ne and #i ncl ude 13
1.5 The Use of pri ntfO and scanfO 18
1.6 Flow of Control 21
1.7 Functions 29
Call-by-Value 35
1.8 Arrays, Strings, and Pointers 36
Arrays 37
Strings 39
Pointers 42
1.9 Files 47
viii ., Contents
., Contents ix