ebook img

C All-in-One Desk Reference For Dummies PDF

843 Pages·2004·7.38 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 C All-in-One Desk Reference For Dummies

01_570692 ffirs.qxd 7/30/04 11:08 AM Page iii C ALL-IN-ONE DESK REFERENCE FOR DUMmIES ‰ by Dan Gookin 01_570692 ffirs.qxd 7/30/04 11:08 AM Page ii 01_570692 ffirs.qxd 7/30/04 11:08 AM Page i C ALL-IN-ONE DESK REFERENCE FOR DUMmIES ‰ 01_570692 ffirs.qxd 7/30/04 11:08 AM Page ii 01_570692 ffirs.qxd 7/30/04 11:08 AM Page iii C ALL-IN-ONE DESK REFERENCE FOR DUMmIES ‰ by Dan Gookin 01_570692 ffirs.qxd 7/30/04 11:08 AM Page iv C All-in-One Desk Reference For Dummies® Published by Wiley Publishing, Inc. 111 River Street Hoboken, NJ 07030-5774 Copyright © 2004 by Wiley Publishing, Inc., Indianapolis, Indiana Published by Wiley Publishing, Inc., Indianapolis, Indiana 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 permis- sion 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 Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355, e-mail: brandreview@ wiley.com. Trademarks:Wiley, the Wiley Publishing 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, 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. Wiley Publishing, 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 COMPE- TENT 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 or to obtain technical support, please con- tact our Customer Care Department within the U.S. at 800-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. Library of Congress Control Number: 2004102339 ISBN: 0-7645-7069-2 Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 1O/RX/QY/QU/IN 01_570692 ffirs.qxd 7/30/04 11:08 AM Page v About the Author Dan Gookinhas been writing about technology for 20 years. He has con- tributed articles to numerous high-tech magazines and written more than 90books about personal computing technology, many of them accurate. He combines his love of writing with his interest in technology to create books that are informative and entertaining, but not boring. Having sold more than 14 million titles translated into more than 30 languages, Dan can attest that his method of crafting computer tomes does seem to work. Perhaps Dan’s most famous title is the original DOS For Dummies,published in 1991. It became the world’s fastest-selling computer book, at one time moving more copies per week than the New York Timesnumber-one best seller (although, because it’s a reference book, it could not be listed on the NYT best seller list). That book spawned the entire line of For Dummies books, which remains a publishing phenomenon to this day. Dan’s most recent titles include PCs For Dummies,9th Edition; Buying a Computer For Dummies, 2005 Edition; Troubleshooting Your PC For Dummies; Dan Gookin’s Naked Windows XP;and Dan Gookin’s Naked Office.He publishes a free weekly computer newsletter, “Weekly Wambooli Salad,” and also main- tains the vast and helpful Web site www.wambooli.com. Dan holds a degree in communications and visual arts from the University of California, San Diego. He lives in the Pacific Northwest, where he enjoys spending time with his four boys in the gentle woods of Idaho. 01_570692 ffirs.qxd 7/30/04 11:08 AM Page vi Publisher’s Acknowledgments We’re proud of this book; please send us your comments through our online registration form located at www.dummies.com/register/. Some of the people who helped bring this book to market include the following: Acquisitions, Editorial, and Media Composition Development Project Coordinator:Maridee Ennis Project Editor:Rebecca Whitney Layout and Graphics:Karl Brandt, Acquisitions Editor:Greg Croy DennyHager, JoyceHaughey, StephanieD.Jumper, MichaelKruzil, Technical Editor:Greg Guntle Melanee Prendergast, Jacque Roth, Editorial Manager:Carol Sheehan JulieTrippetti, Mary Gillot Virgin Editorial Assistant:Amanda M. Foxworth Proofreaders: Arielle Carole Mennelle, Cartoons:Rich Tennant, www.the5thwave.com DwightRamsey, Brian H. Walls Indexer:Infodex Indexing Services Inc. Publishing and Editorial for Technology Dummies Richard Swadley,Vice President and Executive Group Publisher Andy Cummings,Vice President and Publisher Mary Bednarek,Executive Editorial Director Mary C. Corder,Editorial Director Publishing for Consumer Dummies Diane Graves Steele,Vice President and Publisher Joyce Pepple,Acquisitions Director Composition Services Gerry Fahey,Vice President of Production Services Debbie Stailey,Director of Composition Services 02_570692 ftoc.qxd 7/30/04 9:47 AM Page vii Contents at a Glance Introduction ................................................................1 Book I: Hello, C............................................................7 Chapter 1: Your Basic C Program ....................................................................................9 Chapter 2: How It All Works ...........................................................................................19 Chapter 3: More Basics, Comments, and Errors .........................................................33 Chapter 4: Introducing Numbers and Variables ..........................................................47 Chapter 5: More Variables and Basic I/O ......................................................................61 Chapter 6: Decision Time ...............................................................................................79 Chapter 7: Looping ..........................................................................................................89 Chapter 8: Using Constants ..........................................................................................101 Chapter 9: Mysterious Math ........................................................................................109 Chapter 10: It’s Only Logical ........................................................................................123 Book II: Middle C .....................................................133 Chapter 1: Variables from Beyond Infinity .................................................................135 Chapter 2: The Madness of Printf() ............................................................................149 Chapter 3: Maniacal Math Functions ..........................................................................165 Chapter 4: Not Truly Random ......................................................................................181 Chapter 5: While Going Loopy .....................................................................................193 Chapter 6: More Decision Making ...............................................................................205 Chapter 7: The Goto Chapter .......................................................................................217 Book III: Above C Level.............................................221 Chapter 1: Asking for Arrays ........................................................................................223 Chapter 2: I Sing of Strings ...........................................................................................243 Chapter 3: Messing with Characters ...........................................................................265 Chapter 4: Stinkin’ Structures ......................................................................................271 Chapter 5: Creating Your Own Functions ...................................................................293 Chapter 6: Quitting Before You’re Done .....................................................................319 Chapter 7: More Variable Nonsense ............................................................................329

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.