




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
c language book by deitel and deitel
Typology: Study Guides, Projects, Research
Limited-time offer
Uploaded on 11/13/2017
4.6
(11)1 document
1 / 1000
This page cannot be seen from the preview
Don't miss anything!
On special offer
AJAX, Rich Internet Applications and Web Development for Programmers
C++ for Programmers
C# 2008 for Programmers, 3/E
iPhone for Programmers: An App-Driven Approach Java for Programmers Javascript for Programmers
www.deitel.com/books/LiveLessons/
Java Fundamentals Parts 1 and 2
C# Fundamentals Parts 1 and 2
C++ Fundamentals Parts 1 and 2 JavaScript Fundamentals Parts 1 and 2
To receive updates on Deitel publications, Resource Centers, training courses, partner offers and more, please register for the free Deitel ®^ Buzz Online e-mail newsletter at:
www.deitel.com/newsletter/subscribe.html
follow us on Twitter®
@deitel
and Facebook ®
www.deitel.com/deitelfan/
To communicate with the authors, send e-mail to:
deitel@deitel.com
For information on government and corporate Dive-Into ®^ Series on-site seminars offered by Deitel & Associates, Inc. worldwide, visit:
www.deitel.com/training/
or write to
deitel@deitel.com
For continuing updates on Prentice Hall/Deitel publications visit:
www.deitel.com www.pearsonhighered.com/deitel
Check out our Resource Centers for valuable web resources that will help you master Java, other important programming languages, software and Internet- and web-related topics:
www.deitel.com/ResourceCenters.html
Library of Congress Cataloging-in-Publication Data On file
Vice President and Editorial Director, ECS: Marcia J. Horton Editor-in-Chief, Computer Science: Michael Hirsch Associate Editor: Carole Snyder Supervisor/Editorial Assistant: Dolores Mars Director of Team-Based Project Management: Vince O’Brien Senior Managing Editor: Scott Disanno Managing Editor: Robert Engelhardt A/V Production Editor: Greg Dulles Art Director: Kristine Carney Cover Design: Abbey S. Deitel, Harvey M. Deitel, Francesco Santalucia, Kristine Carney Interior Design: Harvey M. Deitel, Kristine Carney Manufacturing Manager: Alexis Heydt-Long Manufacturing Buyer: Lisa McDowell Director of Marketing: Margaret Waples Marketing Manager: Erin Davis
© 2010 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458
The authors and publisher of this book have used their best efforts in preparing this book. These efforts include the development, research, and testing of the theories and programs to determine their effectiveness. The authors and pub- lisher make no warranty of any kind, expressed or implied, with regard to these programs or to the documentation contained in this book. The authors and publisher shall not be liable in any event for incidental or consequential dam- ages in connection with, or arising out of, the furnishing, performance, or use of these programs.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks and registered trademarks. Where those designations appear in this book, and Prentice Hall and the authors were aware of a trademark claim, the designations have been printed in initial caps or all caps. All product names mentioned remain trademarks or registered trademarks of their respective owners.
All rights reserved. No part of this book may be reproduced, in any form or by any means, without permission in writing from the publisher.
Printed in the United States of America
10 9 8 7 6 5 4 3 2 1
ISBN-10: 0-13-612356-
ISBN-13: 978-0-13-612356-
Pearson Education Ltd., London Pearson Education Australia Pty. Ltd., Sydney Pearson Education Singapore, Pte. Ltd. Pearson Education North Asia Ltd., Hong Kong Pearson Education Canada, Inc., Toronto Pearson Educación de Mexico, S.A. de C.V. Pearson Education–Japan, Tokyo Pearson Education Malaysia, Pte. Ltd. Pearson Education, Inc., Upper Saddle River, New Jersey
DEITEL , the double-thumbs-up bug and DIVE INTO are registered trademarks of Deitel and Associates, Inc.
Microsoft, Visual C++, Internet Explorer and the Windows logo are either registered trademarks or trade- marks of Microsoft Corporation in the United States and/or other countries.
In Memory of Clifford Stephens:
Your friendship, bright smile and infectious laugh will be truly missed.
Paul and Harvey Deitel
Website (located at www.pearsonhighered.com/deitel ).
Preface xxi
xvi Contents
xviii Contents
D.4 Programming Sudoku Puzzle Solvers 942 D.5 Generating New Sudoku Puzzles 943 D.6 Conclusion 945
Appendices on the Web 946
Appendices E through I are PDF documents posted online at the book’s Companion Website (located at www.pearsonhighered.com/deitel ).
E Game Programming with the Allegro C Library I
E.1 Introduction II E.2 Installing Allegro II E.3 A Simple Allegro Program III E.4 Simple Graphics: Importing Bitmaps and Blitting IV E.5 Animation with Double Buffering IX E.6 Importing and Playing Sounds XVI E.7 Keyboard Input XX E.8 Fonts and Displaying Text XXV E.9 Implementing the Game of Pong XXXI E.10 Timers in Allegro XXXVII E.11 The Grabber and Allegro Datafiles XLII E.12 Other Allegro Capabilities LI E.13 Allegro Resource Center LII
F Sorting: A Deeper Look LVIII
F.1 Introduction LIX F.2 Big O Notation LIX F.3 Selection Sort LX F.4 Insertion Sort LXIV F.5 Merge Sort LXVII
G Introduction to C99 LXXVIII
G.1 Introduction LXXIX G.2 Support for C99 LXXIX G.3 New C99 Headers LXXX G.4 // Comments LXXX G.5 Mixing Declarations and Executable Code LXXXI G.6 Declaring a Variable in a for Statement Header LXXXII G.7 Designated Initializers and Compound Literals LXXXIV G.8 Type bool LXXXVII G.9 Implicit int in Function Declarations LXXXVIII G.10 Complex Numbers LXXXIX G.11 Variable-Length Arrays XC
Contents xix
G.12 The snprintf Function: Helping Avoid Hacker Attacks XCIII G.13 Additions to the Preprocessor XCV G.14 Other C99 Features XCVI G.15 Web Resources XCIX
H Using the Visual Studio Debugger CIV
H.1 Introduction CV H.2 Breakpoints and the Continue Command CV H.3 Locals and Watch Windows CIX H.4 Controlling Execution Using the Step Into, Step Over, Step Out and Continue Commands CXII H.5 Autos Window CXIV H.6 Wrap-Up CXVI
I Using the GNU Debugger CXVIII
I.1 Introduction CXIX I.2 Breakpoints and the run, stop, continue and print Commands CXIX I.3 print and set Commands CXXIV I.4 Controlling Execution Using the step, finish and next Commands CXXVI I.5 watch Command CXXVIII I.6 Wrap-Up CXXX
Index 947