Full download C Recipes - A Problem-Solution Approach 1st Edition Shirish Chavan pdf docx
Full download C Recipes - A Problem-Solution Approach 1st Edition Shirish Chavan pdf docx
com
https://textbookfull.com/product/c-recipes-a-problem-
solution-approach-1st-edition-shirish-chavan/
OR CLICK BUTTON
DOWNLOAD NOW
https://textbookfull.com/product/android-recipes-a-problem-solution-
approach-dave-smith/
textboxfull.com
https://textbookfull.com/product/raku-recipes-a-problem-solution-
approach-j-j-merelo/
textboxfull.com
https://textbookfull.com/product/javascript-recipes-a-problem-
solution-approach-1st-edition-russ-ferguson/
textboxfull.com
https://textbookfull.com/product/wxpython-recipes-a-problem-solution-
approach-1st-edition-mike-driscoll/
textboxfull.com
MATLAB Recipes: a problem-solution approach 2nd Edition
Michael Paluszek
https://textbookfull.com/product/matlab-recipes-a-problem-solution-
approach-2nd-edition-michael-paluszek/
textboxfull.com
https://textbookfull.com/product/prestashop-recipes-a-problem-
solution-approach-1st-edition-arnaldo-perez-castano-auth/
textboxfull.com
https://textbookfull.com/product/java-ee-7-recipes-a-problem-solution-
approach-1st-edition-juneau-josh/
textboxfull.com
https://textbookfull.com/product/java-9-recipes-a-problem-solution-
approach-3rd-edition-josh-juneau/
textboxfull.com
https://textbookfull.com/product/spring-5-recipes-a-problem-solution-
approach-4th-edition-marten-deinum/
textboxfull.com
C Recipes
A Problem-Solution Approach
—
Shirish Chavan
C Recipes
A Problem-Solution Approach
Shirish Chavan
C Recipes: A Problem-Solution Approach
Shirish Chavan
Sangli, Maharashtra, India
ISBN-13 (pbk): 978-1-4842-2966-8 ISBN-13 (electronic): 978-1-4842-2967-5
DOI 10.1007/978-1-4842-2967-5
Library of Congress Control Number: 2017950166
Copyright © 2017 by Shirish Chavan
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole
or part of the material is concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical
way, and transmission or information storage and retrieval, electronic adaptation, computer
software, or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark
symbol with every occurrence of a trademarked name, logo, or image we use the names, logos,
and images only in an editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if
they are not identified as such, is not to be taken as an expression of opinion as to whether or not
they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the
date of publication, neither the authors nor the editors nor the publisher can accept any legal
responsibility for any errors or omissions that may be made. The publisher makes no warranty,
express or implied, with respect to the material contained herein.
Cover image designed by Freepik
Managing Director: Welmoed Spahr
Editorial Director: Todd Green
Acquisitions Editor: Celestin Suresh John
Development Editor: Matthew Moodie
Technical Reviewer: Yogesh Sharma
Coordinating Editor: Prachi Mehta
Copy Editor: Kim Wimpsett
Compositor: SPi Global
Indexer: SPi Global
Artist: SPi Global
Distributed to the book trade worldwide by Springer Science+Business Media New York,
233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201)
348-4505, e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com. Apress
Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business
Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail rights@apress.com, or visit
www.apress.com/rights-permissions.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook
versions and licenses are also available for most titles. For more information, reference our
Print and eBook Bulk Sales web page at www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this
book is available to readers on GitHub via the book's product page, located at
www.apress.com/978-1-4842-2966-8. For more detailed information, please visit
www.apress.com/source-code.
Printed on acid-free paper
This is dedicated to
Honorable Dr. Patangrao Kadam,
Chancellor at Bharati Vidyapeeth University in Pune.
—Shirish Chavan
Contents at a Glance
■
■Chapter 1: Welcome to C���������������������������������������������������������������� 1
■
■Chapter 2: Control Statements����������������������������������������������������� 13
■
■Chapter 3: Functions and Arrays�������������������������������������������������� 39
■
■Chapter 4: Pointers and Arrays���������������������������������������������������� 75
■
■Chapter 5: Functions and Structures with Pointers������������������� 119
■
■Chapter 6: Data Files������������������������������������������������������������������ 149
■
■Chapter 7: Self-Referential Structures��������������������������������������� 213
■
■Chapter 8: Stacks and Queues���������������������������������������������������� 253
■
■Chapter 9: Searching and Sorting���������������������������������������������� 277
■
■Chapter 10: Cryptographic Systems������������������������������������������� 301
■
■Chapter 11: Numerical Methods������������������������������������������������� 349
v
■ Contents at a Glance
■
■Appendix A: Reference Tables���������������������������������������������������� 403
■
■Appendix B: Library Functions��������������������������������������������������� 415
■
■Appendix C: C Idioms������������������������������������������������������������������ 421
■
■Appendix D: Glossary of Terms��������������������������������������������������� 431
Index���������������������������������������������������������������������������������������������� 439
vi
Contents
■
■Chapter 1: Welcome to C���������������������������������������������������������������� 1
Programs, Software, and Operating System������������������������������������������� 2
Machine Language and Assembly Language������������������������������������������ 2
Procedural Languages����������������������������������������������������������������������������� 3
Object-Oriented Languages��������������������������������������������������������������������� 3
Terminology in Computers���������������������������������������������������������������������� 4
Compiled and Interpreted Languages����������������������������������������������������� 4
Compilation��������������������������������������������������������������������������������������������������������������� 5
Interpretation������������������������������������������������������������������������������������������������������������ 5
■
■Chapter 2: Control Statements����������������������������������������������������� 13
Selection Statements���������������������������������������������������������������������������� 13
Iteration Statements������������������������������������������������������������������������������ 13
Jump Statements���������������������������������������������������������������������������������� 13
vii
■ Contents
viii
■ Contents
■
■Chapter 3: Functions and Arrays�������������������������������������������������� 39
3-1. Determine the Value of Pi�������������������������������������������������������������� 41
Problem������������������������������������������������������������������������������������������������������������������ 41
Solution������������������������������������������������������������������������������������������������������������������ 41
How It Works����������������������������������������������������������������������������������������������������������� 42
ix
■ Contents
x
■ Contents
■
■Chapter 4: Pointers and Arrays���������������������������������������������������� 75
4-1. Retrieve Data from an Array with the int Type Data����������������������� 75
Problem������������������������������������������������������������������������������������������������������������������ 75
Solution������������������������������������������������������������������������������������������������������������������ 75
How It Works����������������������������������������������������������������������������������������������������������� 76
4-3. Retrieve Data from an Array with char and double Type Data������� 80
Problem������������������������������������������������������������������������������������������������������������������ 80
Solution������������������������������������������������������������������������������������������������������������������ 80
How It Works����������������������������������������������������������������������������������������������������������� 82
xi
■ Contents
xii
■ Contents
■
■Chapter 5: Functions and Structures with Pointers������������������� 119
5-1. Pass Arguments by Reference to a Function������������������������������� 119
Problem���������������������������������������������������������������������������������������������������������������� 119
Solution���������������������������������������������������������������������������������������������������������������� 119
How It Works��������������������������������������������������������������������������������������������������������� 121
xiii
■ Contents
xiv
■ Contents
■
■Chapter 6: Data Files������������������������������������������������������������������ 149
6-1. Read a Text File Character by Character�������������������������������������� 149
Problem���������������������������������������������������������������������������������������������������������������� 149
Solution���������������������������������������������������������������������������������������������������������������� 149
How It Works��������������������������������������������������������������������������������������������������������� 150
xv
■ Contents
xvi
■ Contents
xvii
■ Contents
6-19. Write to a File and Then Read from That File����������������������������� 197
Problem���������������������������������������������������������������������������������������������������������������� 197
Solution���������������������������������������������������������������������������������������������������������������� 197
How It Works��������������������������������������������������������������������������������������������������������� 198
■
■Chapter 7: Self-Referential Structures��������������������������������������� 213
7-1. Generate Lists of Numbers in an Interactive Manner������������������ 213
Problem���������������������������������������������������������������������������������������������������������������� 213
Solution���������������������������������������������������������������������������������������������������������������� 214
How It Works��������������������������������������������������������������������������������������������������������� 215
xviii
■ Contents
xix
■ Contents
■
■Chapter 8: Stacks and Queues���������������������������������������������������� 253
8-1. Implement a Stack as an Array���������������������������������������������������� 254
Problem���������������������������������������������������������������������������������������������������������������� 254
Solution���������������������������������������������������������������������������������������������������������������� 254
How It Works��������������������������������������������������������������������������������������������������������� 258
8-2. Implement a Stack as a Linked List��������������������������������������������� 258
Problem���������������������������������������������������������������������������������������������������������������� 258
Solution���������������������������������������������������������������������������������������������������������������� 258
How It Works��������������������������������������������������������������������������������������������������������� 263
■
■Chapter 9: Searching and Sorting���������������������������������������������� 277
9-1. Find a Data Element Using a Linear Search��������������������������������� 278
Problem���������������������������������������������������������������������������������������������������������������� 278
Solution���������������������������������������������������������������������������������������������������������������� 278
How It Works��������������������������������������������������������������������������������������������������������� 280
xx
■ Contents
xxi
■ Contents
■
■Chapter 10: Cryptographic Systems������������������������������������������� 301
10-1. Use the Reverse Cipher Method������������������������������������������������ 303
Problem���������������������������������������������������������������������������������������������������������������� 303
Solution���������������������������������������������������������������������������������������������������������������� 304
How It Works��������������������������������������������������������������������������������������������������������� 306
10-2. Use the Caesar Cipher Method�������������������������������������������������� 307
Problem���������������������������������������������������������������������������������������������������������������� 307
Solution���������������������������������������������������������������������������������������������������������������� 307
How It Works��������������������������������������������������������������������������������������������������������� 310
xxii
■ Contents
■
■Chapter 11: Numerical Methods������������������������������������������������� 349
11-1. To Find the Roots of an Equation Using the Bisection Method��� 350
Problem���������������������������������������������������������������������������������������������������������������� 350
Solution���������������������������������������������������������������������������������������������������������������� 350
How It Works��������������������������������������������������������������������������������������������������������� 352
xxiii
■ Contents
xxiv
■ Contents
xxv
■ Contents
■
■Appendix A: Reference Tables���������������������������������������������������� 403
■
■Appendix B: Library Functions��������������������������������������������������� 415
Character Testing and Processing Functions�������������������������������������� 415
String Processing Functions��������������������������������������������������������������� 416
Mathematical Functions���������������������������������������������������������������������� 417
Utility Functions����������������������������������������������������������������������������������� 419
■
■Appendix C: C Idioms������������������������������������������������������������������ 421
■
■Appendix D: Glossary of Terms��������������������������������������������������� 431
Index���������������������������������������������������������������������������������������������� 439
xxvi
About the Author
xxvii
About the Technical
Reviewer
xxix
Acknowledgments
Thanks to everyone working at Apress who made this book possible. I am particularly
thankful to Mr. Celestin Suresh John, acquisitions editor, and Ms. Prachi Mehta,
coordinating editor, for their patience and guidance.
A good number of my techie friends helped me on technical matters in this book.
Notable among them are Mr. Ajay Dhande, CEO of Cryptex Technologies in Nagpur
(www.cryptextechnologies.com); Prof. Shivajirao Salunkhe and Prof. Manisha
Salunkhe of Harsh Computer Institute in Satara; Dr. Vilas Pharande, Principal at
Arvind Gavali College of Engineering in Satara (www.agce.sets.edu.in); Prof. Sachin
Pratapure and Prof. Vishal Khade at Kalasagar Academy (www.kalasagaracademy.in)
in Wai, Satara; Prof. Anant Bodas and Prof. Vikas Dhane at Yashoda College of
Engineering in Satara; Prof. Sanjay Adhau of Shrikant Computer Training Center,
Amravati (https://www.sctcamravati.com); Dr. Mir Sadique Ali, Principal, P R M I T
& R, Amravati (mitra.ac.in); and Mr. Nikhil Kumbhar, CEO of Aphron Infotech in Pune
(www.aphroninfotech.in). I am also thankful to Mr. Tushar Soni and Mr. Ajay Sawant,
who run the web site Coding Alpha (www.codingalpha.com), and Mr. Neeraj Mishra,
who runs the web site The Crazy Programmer (www.thecrazyprogrammer.com), for their
valuable help in the making of this book.
Dr. Vijay Bhatkar, eminent computer scientist and father of the Indian
supercomputer PARAM 10000, has been a source of inspiration for me. I am grateful to
him for inspiring me.
Last but not least, I am always thankful to Mr. Jarron & Mr. John Borges and their
active Technical Book Services team in Pune for the prompt supply of books.
Thank you, Sirs and Madams, you all made this book possible. Finally, a note: Pune,
Nagpur, and Satara are cities in Maharashtra, India.
xxxi
Random documents with unrelated
content Scribd suggests to you:
vous estes navrés et mis en peril de mort.» Là ploroient
20 moult tenrement cil qui li estoient autour.
Bien les entendoit et se complaindoit, mès nul mot ne
pooit parler. Là tordoient leurs poins et tiroient leurs
cheviaus et jettoient grans cris et grans plains, par
especial li chevalier et li escuier de son hostel. Là fu
25 li dis monsigneur Jehan Chandos de ses gens desarmés
moult doucement et couchiés sus targes et sus
pavais, et amenés et aportés tout le pas à Mortemer,
le plus proçainne forterèce de là. Et li autre baron et
chevalier retournèrent à Poitiers, et là menèrent il
30 leurs prisonniers. Si entendi que cilz Jakes de Saint
Martin, qui avoit navré le dit monsigneur Jehan Chandos,
fu si mal poursongniés de ses plaies qu’il morut
[207] à Poitiers. Li gentilz chevaliers dessus nommés ne
vesqui de ceste navrure q’un jour et une nuit, et
morut. Diex en ait l’ame pour se deboinaireté; car
onques, depuis cent ans, ne fu plus courtois, plus gentilz
5 ne plus plains de toutes bonnes et nobles vertus
et conditions, entre les Englès, de lui.
Quant li princes et la princesse, li contes de Cantbruge,
li contes de Pennebruch et li baron et chevalier
d’Engleterre, qui estoient en Giane, sceurent la mort
10 dou dessus dit, si furent durement courecié et desconforté,
et disent bien qu’il avoient trop perdu. Partout,
deça et dela le mer, de ses amis et amies fu plains et
regretés messires Jehans Chandos; et li rois de France
et li signeur en France l’eurent tantost ploré. Ensi
15 aviennent les besongnes. Li Englès l’amoient, pour
tant qu’en li estoient toutes hautainnes emprises. Li
François le haioient, pour ce qu’il le ressongnoient. Si
l’oy je bien, en ce temps, plaindre et regreter des bons
chevaliers et des vaillans de France. Et disoient ensi
20 que de lui estoit grans damages, et mieuls vausist
qu’il euist esté pris que mors; car, se il euist esté pris,
il estoit bien si sages et si imaginatis que il euist trouvé
aucun moiien, par quoi pais euist esté entre France
et Engleterre, et si estoit tant amés dou roy d’Engleterre
25 et de ses enfans qu’il l’euissent creu plus
que tout le monde. Si perdirent François et Englès
moult à se mort, ne onques je n’en oy dire aultre
cose, et plus li Englès que li François; car par lui, en
Ghiane, euissent esté faites toutes recouvrances.
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.
textbookfull.com