C how to program Seventh Edition. Edition Deitel all chapter instant download
C how to program Seventh Edition. Edition Deitel all chapter instant download
com
https://ebookname.com/product/c-how-to-program-seventh-
edition-edition-deitel/
OR CLICK HERE
DOWLOAD NOW
https://ebookname.com/product/c-how-to-program-8th-edition-paul-
deitel/
ebookname.com
https://ebookname.com/product/java-how-to-program-6th-edition-harvey-
deitel-paul-deitel/
ebookname.com
https://ebookname.com/product/java-how-to-program-late-objects-
version-8th-edition-deitel/
ebookname.com
https://ebookname.com/product/eihei-do-gen-mystical-realist-3-revised-
edition-dogen/
ebookname.com
Psychology in Context 1st Edition Stephen Michael Kosslyn
https://ebookname.com/product/psychology-in-context-1st-edition-
stephen-michael-kosslyn/
ebookname.com
https://ebookname.com/product/yu-gi-oh-3-in-1-edition-vol-6-includes-
vols-16-17-18-kazuki-takahashi/
ebookname.com
https://ebookname.com/product/the-unofficial-guide-to-microsoft-
office-excel-2007-unofficial-guide-1st-edition-julia-kelly/
ebookname.com
https://ebookname.com/product/rescuing-justice-and-equality-g-a-cohen/
ebookname.com
The Prester John Legend between East and West During the
Crusades 1st Edition Ahmed M. A. Sheir
https://ebookname.com/product/the-prester-john-legend-between-east-
and-west-during-the-crusades-1st-edition-ahmed-m-a-sheir/
ebookname.com
Mappae Mundi Humans and their Habitats in a Long Term
Socio Ecological Perspective Myths Maps and Models 2nd
Edition Johan Goudsblom
https://ebookname.com/product/mappae-mundi-humans-and-their-habitats-
in-a-long-term-socio-ecological-perspective-myths-maps-and-models-2nd-
edition-johan-goudsblom/
ebookname.com
Deitel® Series Page
How To Program Series (continued from previous column)
Visual Basic® 2010 How to Program
Android How to Program
Visual Basic® 2008 How to Program
C++ How to Program, 8/E
Visual C#® 2010 How to Program, 4/E
C How to Program, 7/E
Visual C#® 2008 How to Program, 3/E
Java™ How to Program, 9/E
Java™ How to Program, Late Objects Version, 8/E
Internet & World Wide Web How to Program, 5/E
Deitel® Developer Series
Visual C++® 2008 How to Program, 2/E AJAX, Rich Internet Applications and Web
Visual Basic® 2010 How to Program Development for Programmers
Visual C#® 2010 How to Program, 3/E Android for Programmers: An App-Driven
Approach
C++ for Programmers
Simply Series C# 2010 for Programmers
Simply C++: An App-Driven Tutorial Approach iPhone® for Programmers: An App-Driven Approach
Simply Java™ Programming: An App-Driven Java™ for Programmers, 2/e
Tutorial Approach JavaScript for Programmers
Simply C#: An App-Driven Tutorial Approach
Simply Visual Basic® 2010: An App-Driven LiveLessons Video Learning Products
Approach, 4/E
www.deitel.com/books/LiveLessons/
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
and join the Deitel communities on Twitter®
@deitel
Facebook®
facebook.com/DeitelFan
and Google+
gplus.to/deitel
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/
Visit the Deitel Resource Centers that will help you master programming languages, software develop-
ment, Android and iPhone/iPad app development, and Internet- and web-related topics:
www.deitel.com/ResourceCenters.html
Paul Deitel
Deitel & Associates, Inc.
Harvey Deitel
Deitel & Associates, Inc.
Editorial Director: Marcia J. Horton
Editor-in-Chief: Michael Hirsch
Associate Editor: Carole Snyder
Vice President, Marketing: Patrice Jones
Marketing Manager: Yezan Alayan
Marketing Coordinator: Kathryn Ferranti
Vice President, Production: Vince O’Brien
Managing Editor: Jeff Holcomb
Associate Managing Editor: Robert Engelhardt
Operations Specialist: Lisa McDowell
Art Director: Anthony Gemmellaro
Cover Design: Paul Deitel, Harvey Deitel, Abbey Deitel, Anthony Gemmellaro
Cover Photo Credit: Excellent backgrounds/Shutterstock.com
Media Editor: Daniel Sandin
Credits and acknowledgments borrowed from other sources and reproduced, with permission, in this textbook appear
on page vi.
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.
Copyright © 2013, 2010, 2007, 2004, 2001 Pearson Education, Inc., publishing as Prentice Hall. All rights reserved.
Manufactured in the United States of America. This publication is protected by Copyright, and permission should be
obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any
form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission(s) to use
material from this work, please submit a written request to Pearson Education, Inc., Permissions Department, One
Lake Street, Upper Saddle River, New Jersey 07458, or you may fax your request to 201-236-3290.
Many of the designations by manufacturers and sellers to distinguish their products are claimed as trademarks. Where
those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been
printed in initial caps or all caps.
Library of Congress Cataloging-in-Publication Data
Deitel, Paul J.
C : how to program / Paul Deitel, Deitel & Associates, Inc., Harvey Deitel, Deitel & Associates,
Inc., Abbey Deitel, Deitel & Associates, Inc. -- Seventh edition.
pages cm -- (How to program series)
ISBN 978-0-13-299044-8
1. C (Computer program language) 2. C++ (Computer program language) 3. Java (Computer program
language) I. Deitel, Harvey M., II. Deitel, Abbey. III. Title.
QA76.73.C15D44 2012
005.13'3--dc23
2011051087
10 9 8 7 6 5 4 3 2 1
ISBN-10: 0-13-299044-X
ISBN-13: 978-0-13-299044-8
In Memory of Dennis Ritchie,
creator of the C programming language
and co-creator of the UNIX operating system.
Paul and Harvey Deitel
Trademarks
DEITEL, the double-thumbs-up bug and DIVE INTO are registered trademarks of Deitel and Associates,
Inc.
MICROSOFT AND/OR ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS
ABOUT THE SUITABILITY OF THE INFORMATION CONTAINED IN THE DOCUMENTS
AND RELATED GRAPHICS PUBLISHED AS PART OF THE SERVICES FOR ANY PURPOSE.
ALL SUCH DOCUMENTS AND RELATED GRAPHICS ARE PROVIDED "AS IS" WITHOUT
WARRANTY OF ANY KIND. MICROSOFT AND/OR ITS RESPECTIVE SUPPLIERS HEREBY
DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THIS INFORMA-
TION, INCLUDING ALL WARRANTIES AND CONDITIONS OF MERCHANTABILITY,
WHETHER EXPRESS, IMPLIED OR STATUTORY, FITNESS FOR A PARTICULAR PURPOSE,
TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL MICROSOFT AND/OR ITS
RESPECTIVE SUPPLIERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PER-
FORMANCE OF INFORMATION AVAILABLE FROM THE SERVICES.
THE DOCUMENTS AND RELATED GRAPHICS CONTAINED HEREIN COULD INCLUDE
TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS. CHANGES ARE PERIODI-
CALLY ADDED TO THE INFORMATION HEREIN. MICROSOFT AND/OR ITS RESPECTIVE
SUPPLIERS MAY MAKE IMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S) AND/
OR THE PROGRAM(S) DESCRIBED HEREIN AT ANY TIME. PARTIAL SCREEN SHOTS
MAY BE VIEWED IN FULL WITHIN THE SOFTWARE VERSION SPECIFIED.
Contents
Appendices E through H are PDF documents posted online at the book’s Companion
Website (located at www.pearsonhighered.com/deitel).
Preface xix
2 Introduction to C Programming 40
2.1 Introduction 41
2.2 A Simple C Program: Printing a Line of Text 41
2.3 Another Simple C Program: Adding Two Integers 45
2.4 Memory Concepts 49
2.5 Arithmetic in C 50
2.6 Decision Making: Equality and Relational Operators 54
2.7 Secure C Programming 58
5 C Functions 158
5.1 Introduction 159
5.2 Program Modules in C 159
5.3 Math Library Functions 160
5.4 Functions 162
5.5 Function Definitions 162
5.6 Function Prototypes: A Deeper Look 166
5.7 Function Call Stack and Stack Frames 169
5.8 Headers 172
5.9 Passing Arguments By Value and By Reference 173
5.10 Random Number Generation 174
5.11 Example: A Game of Chance 179
5.12 Storage Classes 182
5.13 Scope Rules 184
5.14 Recursion 187
5.15 Example Using Recursion: Fibonacci Series 191
5.16 Recursion vs. Iteration 194
5.17 Secure C Programming 197
6 C Arrays 216
6.1 Introduction 217
6.2 Arrays 217
6.3 Defining Arrays 218
6.4 Array Examples 219
6.5 Passing Arrays to Functions 232
6.6 Sorting Arrays 236
6.7 Case Study: Computing Mean, Median and Mode Using Arrays 239
6.8 Searching Arrays 244
6.9 Multidimensional Arrays 249
6.10 Variable-Length Arrays 256
6.11 Secure C Programming 259
7 C Pointers 277
7.1 Introduction 278
7.2 Pointer Variable Definitions and Initialization 278
7.3 Pointer Operators 279
7.4 Passing Arguments to Functions by Reference 282
7.5 Using the const Qualifier with Pointers 284
7.5.1 Converting a String to Uppercase Using a Non-Constant
Pointer to Non-Constant Data 287
x Contents
13 C Preprocessor 517
13.1 Introduction 518
13.2 #include Preprocessor Directive 518
Contents xiii
“Sir,—
“After carefully perusing the letter of your
correspondent, dated Scutari, in your impression of Wednesday
last, I perceive that, although the kitchen under the
superintendence of Miss Nightingale affords so much relief, the
system of management at the large one in the Barrack Hospital
is far from being perfect. I propose offering my services
gratuitously, and proceeding direct to Scutari at my own
personal expense, to regulate that important department, if the
Government will honour me with their confidence, and grant me
the full power of acting according to my knowledge and
experience in such matters.
“I have the honour to remain, sir,
“Your obedient servant,
“A. Soyer.”
It is the cause, and not the death, that makes the martyr.—Napoleon.
Before many weeks had passed by, Miss Nightingale was again
called to mourn the loss of another of her helpers. The next claimed
by death was Sister Winifred, a Sister of Charity, who, with other
nuns from Ireland, was tending the Irish soldiers in the hospital at
Balaclava, to which they had recently come from Scutari and Kullali.
Only a few days after her arrival Sister Winifred was attacked by
cholera, which had broken out afresh at Balaclava.
Very touching is the account which Sister Mary Aloysius gives of
the death of her comrade: “Our third day in Balaclava was a very
sad one for us. One of our dear band, Sister Winifred, got very ill
during the night with cholera. She was a most angelic sister, and we
were all deeply grieved. She was attacked at about three o’clock in
the morning with the symptoms which were now so well known to
us; every remedy was applied; our beloved Rev. Mother never left
her. She was attended by Father Unsworth, from whom she received
the last rites of our holy religion; and she calmly breathed her last
on the evening of the same day. A hut was arranged in which to
place the remains; and so alarming were the rats—and such huge
animals were they—that we had to watch during the night so that
they should not touch her. She, the first to go of our little band (viz.
the Roman Catholic sisters), had been full of life and energy the day
before. We were all very sad, and we wondered who would be the
next.”
A burial-place was found for Sister Winifred on a piece of ground
between two rocks, on the hills of Balaclava, where her remains
could repose without fear of desecration. The funeral formed a
contrast to that of the Protestant sister at Smyrna, but was equally
impressive. We can picture the sad cavalcade, distinguished by the
symbols of the Roman Catholic faith, wending its way up the hillside
to the lonely spot in the rocks above the Black Sea. Two priests
preceded the coffin, chanting the prayers, and the black-robed nuns
came closely behind, while soldiers and military and medical officers
followed.
Amongst the mourning band walked one tall, slight figure
dressed simply in black whose presence arrested attention. It was
Florence Nightingale, who had come to pay her tribute of love and
honour to the sister who, if divided by faith, had been united with
her in holy work and deeds of mercy.
A tribute was paid to the memory of Sister Winifred in a poem
by a friend, from which we quote the following verses:—
They laid her in her lonely grave upon a foreign strand,
Far from her own dear island home, far from her native land.
They bore her to her long last home amid the clash of arms,
And the hymn they sang seemed sadly sweet amid war’s fierce
alarms.
They heeded not the cannon’s roar, the rifle’s deadly shot,
But onward still they sadly went to gain that lowly spot;
And there, with many a fervent prayer and many a word of love,
They left her in her lowly grave with a simple cross above.
* * * * *
Yet far away from her convent grey, and far from her lowly cell,
And far from the soft and silvery tone of the sweet convent bell,
And far from the home she loved so well, and far from her native
sky,
’Mid the cannon’s roar on a hostile shore she laid her down to die.
* * * * *
She went not forth to gain applause, she sought not empty fame;
E’en those she tended might not know her history or her name;
No honours waited on her path, no flattering voice was nigh;
For she only sought to toil and love, and ’mid her toil to die.
* * * * *
And most glorious its lot to point out to the stranger,
The hallowed remains of the sainted and blest;
For those angels of mercy that dared every danger
To bring to the soldier sweet comfort and rest.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookname.com