ebook img

Beginning programming with C for dummies PDF

489 Pages·2013·3.96 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Beginning programming with C for dummies

Beginning Programming with C For Dummies® Published byJohn Wiley & Sons, Inc.111 River StreetHoboken, NJ 07030- 5774 www.wiley.com Copyright © 2014 by John Wiley & Sons, Inc., Hoboken, New Jersey Published by John Wiley & Sons, Inc., Hoboken, New Jersey Published simultaneously in Canada 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, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646- 8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions. Trademarks: Wiley, the Wiley logo, For Dummies, the Dummies Man logo, A Reference for the Rest of Us!, The Dummies Way, Dummies Daily, The Fun and Easy Way, Dummies.com, Making Everything Easier, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates in the United States and other countries, and may not be used without written permission. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc., is not associated with any product or vendor mentioned in this book. Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Website is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Website may provide or recommendations it may make. Further, readers should be aware that Internet Websites listed in this work may have changed or disappeared between when this work was written and when it is read. For general information on our other products and services, please contact our Customer Care Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002. For technical support, please visit www.wiley.com/techsupport. Wiley also publishes its books in a variety of electronic formats and by print- on-demand. Not all content that is available in standard print versions of this book may appear or be packaged in all book formats. If you have purchased a version of this book that did not include media that is referenced by or accompanies a standard print version, you may request this media by visiting http://booksupport.wiley.com. For more information about Wiley products, visit us at www.wiley.com. Library of Congress Control Number: 2013948031 ISBN 978-1-11873763-7 (pbk); ISBN 978-1-118-73765-1 (ebk); ISBN 978- 1-118-73762-0 (ebk) Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 Beginning Programming with C For ® Dummies Visit www.dummies.com/cheatsheet/beginningprogrammingwithc to view this book's cheat sheet. Table of Contents Introduction Is the C Language Relevant? The C Programming For Dummies Approach How This Book Works Icons Used in This Book Parting Thoughts Part I: Getting Started with C Programming Chapter 1: A Quick Start for the Impatient What You Need in Order to Program Obtaining programming tools Acquiring an Integrated Development Environment (IDE) Behold the Code::Blocks IDE Installing Code::Blocks Touring the Code::Blocks workspace Your First Project Creating a new project Examining the source code Building and running the project Saving and closing Chapter 2: The Programming Thing The History of Programming Reviewing early programming history Introducing the C language The Programming Process Understanding programming Writing source code Compiling to object code Linking in the C library Running and testing Chapter 3: Anatomy of C Parts of the C Language Keywords Functions Operators Variables and values Statements and structure Comments Behold the Typical C Program Understanding C program structure Setting the main() function Returning something to the operating system Adding a function Part II: C Programming 101 Chapter 4: Trials and Errors Display Stuff on the Screen Displaying a humorous message Introducing the puts() function Adding more text Commenting out a statement Goofing up on purpose More Display Nonsense Displaying text with printf() Introducing the printf() function Understanding the newline Employing escape sequences Goofing up on purpose again Chapter 5: Values and Constants A Venue for Various Values Understanding values Displaying values with printf() Minding the extra zeroes The Computer Does the Math Doing simple arithmetic Reviewing the float-integer thing Always the Same Using the same value over and over Introducing constants Putting constants to use Chapter 6: A Place to Put Stuff Values That Vary Setting up a quick example Introducing the variable types Using variables Variable Madness! Using more-specific variable types Creating multiple variables Assigning a value upon creation Reusing variables Chapter 7: Input and Output Character I/O Understanding input and output devices Fetching characters with getchar() Using the putchar() function Working with character variables Text I/O, but Mostly I Storing strings Introducing the scanf() function Reading a string with scanf() Reading values with scanf() Using fgets() for text input Chapter 8: Decision Making If What? Making a simple comparison Introducing the if keyword Comparing values in various ways Knowing the difference between = and == Forgetting where to put the semicolon Multiple Decisions Making more-complex decisions Adding a third option Multiple Comparisons with Logic Building a logical comparison Adding some logical operators The Old Switch Case Trick Making a multiple-choice selection Understanding the switch-case structure Taking no breaks The Weird ?: Decision Thing Chapter 9: Loops, Loops, Loops A Little Déjà Vu The Thrill of for Loops Doing something x number of times Introducing the for loop Counting with the for statement Looping letters Nesting for loops The Joy of the while Loop Structuring a while loop Using the do-while loop

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.