C All-in-One Desk Reference For Dummies - Dan Gookin - E-Book

C All-in-One Desk Reference For Dummies E-Book

Dan Gookin

4,9
26,99 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.
Mehr erfahren.
Beschreibung

Ready, set, code! A user-friendly guide introducing the C programming language to new and intermediate coders The C programming language and its direct descendants are widespread and among the most popular programming languages used in the world today. The enduring popularity of C continues because C programs are fast, concise, and run on many different systems. Flexible and efficient, C is designed for a wide variety of programming tasks: system-level code, text processing, graphics, telecommunications, and many other application areas. C All-in-One Desk Reference For Dummies is for beginning and intermediate C programmers and provides a solid overview of the C programming language, from the basics to advanced concepts, with several exercises that give you real-world practice. C All-in-One Desk Reference For Dummies covers everything users need to get up to speed on C programming, including advanced topics to take their programming skill to the next level. Inside you'll learn * The entire development cycle of a C program: designing and developing the program, writing source code, compiling the code, linking the code to create the executable programs, debugging, and deployment * The intricacies of writing the code -- the basic and not-so-basic building blocks that make up the source code * Thorough coverage of keywords, program flow, conditional statements, constants and variables, numeric values, arrays, strings, functions, pointers, debugging, prototyping, and more * Dozens of sample programs you can adapt and modify for your own use Written in plain English, this friendly guide also addresses some advanced programming topics, such as * Programming for the Linux/Unix console * Windows and Linux programming * Graphics programming * Games programming * Internet and network programming * Hardware programming projects The book includes a handy appendix that shows you how to set up your computer for programming, how to select and use a text editor, and fix up the compiler, to ensure you're ready to work the author's examples. Written by Dan Gookin, the author of the first-ever For Dummies book (and several others) who's known for presenting complex material in an easy-to-understand way, this comprehensive guide makes learning the C programming language simple and fun. Grab your copy of C All-in-One Desk Reference For Dummies, so you can start coding your own programs.

Sie lesen das E-Book in den Legimi-Apps auf:

Android
iOS
von Legimi
zertifizierten E-Readern

Seitenzahl: 827

Bewertungen
4,9 (18 Bewertungen)
16
2
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



C All-in-One Desk Reference For Dummies

by Dan Gookin

C All-in-One Desk Reference For Dummies®

Published byWiley Publishing, Inc.111 River St.Hoboken, NJ 07030-5774www.wiley.com

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 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 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 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 or to obtain technical support, please contact 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: 978-0-7645-7069-8

Manufactured in the United States of America

10 9 8 7 6 5 4

1O/RX/QY/QU/IN

About the Author

Dan Gookin has been writing about technology for 20 years. He has contributed articles to numerous high-tech magazines and written more than 90 books 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 Times number-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 maintains 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.

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 Development

Project Editor: Rebecca Whitney

Acquisitions Editor: Greg Croy

Technical Editor: Greg Guntle

Editorial Manager: Carol Sheehan

Editorial Assistant: Amanda M. Foxworth

Cartoons: Rich Tennant, www.the5thwave.com

Composition

Project Coordinator: Maridee Ennis

Layout and Graphics: Karl Brandt, Denny Hager, Joyce Haughey, Stephanie D. Jumper, Michael Kruzil, Melanee Prendergast, Jacque Roth, Julie Trippetti, Mary Gillot Virgin

Proofreaders: Arielle Carole Mennelle, Dwight Ramsey, 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

Contents

Title

Introduction

Why Bother with C When C++ Is Obviously Blah-Blah-Blah?

About This Here Dummies Approach

How This Book Works

Icons Used in This Book

Final Thots

Book I : Hello, C

Chapter 1: Your Basic C Program

The Section Where the Author Cannot Resist Describing the History of C

Time to Program!

The C Skeleton

Chapter 2: How It All Works

Your Computer Programming Bag of Tools

The C Programming Language

Putting It Together in the Editor

Making a Program

Chapter 3: More Basics, Comments, and Errors

Simple “Hello” Programs

Adding Comments, Remarks, and Suggestions

Debugging

Chapter 4: Introducing Numbers and Variables

Going Numb with Numbers

Introduction to Variables

The Official Introduction to Basic Math Operators

Chapter 5: More Variables and Basic I/O

The Good Ol’ char Variable

Getting Input from the Keyboard

Summary of Basic Text I/O Functions

Chapter 6: Decision Time

Making Decisions with if

else , the Anti- if Statement

Or Else!

Making Multiple Decisions

Chapter 7: Looping

Presenting the for Loop

Endless Loops

Nesting Loops

The 17,576 Names of God

Multiple for Conditions

Chapter 8: Using Constants

Are Constants Necessary?

Constants: The Anti-Variable!

Other Things You Can #define

Chapter 9: Mysterious Math

Math Review

The Sacred Order of Precedence

Say It Out Loud: Unary Operators!

Incrementing and Decrementing and Loving It

Other Cryptic Math Shortcuts

Chapter 10: It’s Only Logical

Comparisons from Hell

Here Are Your Logical Operators, Mr. Spock!

Multiple Madness with Logical Operators

Book II : Middle C

Chapter 1: Variables from Beyond Infinity

Review of C Language Variable Types

Signed, Unsigned, Soap, No Soap, Radio

Fair and Unfair Variables

Typecasting and Other Acting Problems

C Language Variable Reference

Chapter 2: The Madness of Printf()

Going Numb with Numbering Systems

Putting Printf() to the Test

Chapter 3: Maniacal Math Functions

The Symbols That C Forgot

Trigonometric Functions

Other Handy Math Functions

Chapter 4: Not Truly Random

Introducing the random() Function

The Diabolical Dr. Modulus

Chapter 5: While Going Loopy

The while Loop

The do-while Loop

Messing with Loops

Chapter 6: More Decision Making

The Old Switch Case Trick

The Weird and Creepy ?: Construct

Bonus Program!

Chapter 7: The Goto Chapter

What Now? Go To!

The Basic goto Thing

Where goto Is Perhaps Needed

Book III : Above C Level

Chapter 1: Asking for Arrays

Beyond Normal Variables

Sorting an Array

Arrays from Beyond the First Dimension!

Bonus Program!

Chapter 2: I Sing of Strings

The Strings Review

The Truth about Strings

Lovely and Handy String Functions

The Boggling Concept of Arrays of Strings

Chapter 3: Messing with Characters

Introducing the CTYPE Functions

Characters That Tell the Truth

Just a Trivial Program Example

Altering Text

Chapter 4: Stinkin’ Structures

Life without Structures

Multivariables!

Arrays of Structures

Structures for the Birds (Nested Structures)

Chapter 5: Creating Your Own Functions

Your Typical Function

Functions That Don’t Func

Using Variables in Functions

Functions That Eat Values

Functions That Return a Value

Functions That Do Both

The Land of No Prototyping

Chapter 6: Quitting Before You’re Done

Abruptly Leaving the main() Function

A Most Graceful Exit

Chapter 7: More Variable Nonsense

The Joys of Hungarian Notation

Beware the typedef Statement!

Other Funky Variable Things

The State of the union

Book IV : Advanced C

Chapter 1: Introduction to Evil Pointers

Basic Boring Computer Memory Stuff

Some Pointers

The Insanity of Pointer Arithmetic

Chapter 2: Getting to the *Point

Pointer Review

And Now, the Asterisk, Please

Using * pointers to Modify Variables

Chapter 3: Binary Bits

Say Hello to Mr. Bit

Basic Bit Twiddling

The Utter Inanity of Binary Logic

Displaying Binary Values

Two Stragglers: ^ and ~

Chapter 4: The Myth of the Array

Pointers and Arrays

Death to the Array!

The Weird Relationship between Pointers and Array Brackets

Arrays and Pointers Summary

Chapter 5: Pointers and Strings

Using Pointers to Display Strings

Distinguishing Strings from Chars

Declaring a String by Using a Char Pointer

Chapter 6: Crazy Arrays of Pointers

Introducing the Pointer Array

Saving Some Space with String Pointer Arrays

Finding Characters in a Pointer String Array

Sorting Strings with Pointers

Chapter 7: Functions and Pointers

Passing a Pointer to a Function

Arrays to and from Functions

Strings, Functions, and Pointers

Chapter 8: Structures, Pointers, and the Malloc Deity

Making Sacrifices to Malloc

Malloc’s More Useful Relatives

Using Pointers and Malloc to Make New Structures

Chapter 9: Does Anyone Have the Time?

No, Seriously: What Time Is It, Really?

Getting the Time

Getting at the Individual Time-and-Date Pieces’ Parts

Just a Sec!

Chapter 10: Building Big Programs

Making Programs with Multiple Modules

The Tiny, Silly Examples

The Big Lotto Program

Chapter 11: Help!

Debugging

Helpful Utilities

Book V : Disk Drive C

Chapter 1: Just Your Standard I/O

Programming without Any I/O

But, What Is Standard I/O?

A Demonstration of Standard I/O

Writing Filters

Chapter 2: Interacting with the Command Line

Reading the Command Line

Running Another Program with system()

Dealing with the Exit Status

Chapter 3: Hello, Disk!

Fopen the Ffile, Fplease

Would You Like Binary or Text with That?

Chapter 4: More Formal File Writing and Reading

Formatted File Input and Output

Reading and Writing File Chunks

Chapter 5: Random Access Files

The Random Access Demonstration

Building a Disk-Based Database

Chapter 6: Folder Folderol

Who Knows What Lurks on Disk?

Grabbing Information about a File with stat()

Reading a Directory

Directories Hither, Thither, and Yon

The Art of Recursion

Chapter 7: Under New File Management

Renaming a File

Deleting a File

Copying or Duplicating a File

Moving a File (The Secret)

Book VI : The Joy of Linked Lists

Chapter 1: Why Linked Lists?

A Review of Database Programming in C

How Linked Lists Work

Chapter 2: Dawn of the Database

The Ubiquitous Bank Account Program

Removing Records from a Linked List

Chapter 3: Storing a Linked List on Disk

From Memory to Disk and Back Again

The Final Code Listing for BANK.C

Chapter 4: The Nightmare of the Double-Linked List

The Theory of the Double-Linked List

An Example of a Double-Linked List

Deleting an Item from a Double-Linked List

Book VII : Appendixes

Appendix A: The Stuff You Need to Know before Reading Everything Else in This Book

Setting Things Up

Making Programs

Appendix B: ASCII Table

Appendix C: Answers to Exercises

Book I: Hello, C

Book II: Middle C

Book III: Above C Level

Book IV: Advanced C

Book V: Disk Drive C

Book VI: The Joy of Linked Lists

Appendix D: C Language Keywords and Operators

Appendix E: C Language Variable Types

Appendix F: Escape Sequences

Appendix G: Conversion Characters

Book I

Hello, C