while (dead_horse) beat ():
If you're like most people, the above seems like nonsense. Actually, it's computer sense--C programming. After digesting C For Dummies, 2nd Edition, you'll understand it. C programs are fast, concise and versatile. They let you boss your computer around for a change. So turn on your computer, get a free compiler and editor (the book tells you where), pull up a chair, and get going. You won't have to go far (page 13) to find your first program example. You'll do short, totally manageable, hands-on exercises to help you make sense of:
All 32 keywords in the C language (that's right--just 32 words) The functions--several dozen of them Terms like printf(), scanf(), gets (), and puts () String variables, numeric variables, and constants Looping and implementation Floating-point values In case those terms are almost as intimidating as the idea of programming, be reassured that C For Dummies was written by Dan Gookin, bestselling author of DOS For Dummies, the book that started the whole library. So instead of using expletives and getting headaches, you'll be using newly acquired skills and getting occasional chuckles as you discover how to:
Design and develop programs Add comments (like post-it-notes to yourself) as you go Link code to create executable programs Debug and deploy your programs Use lint, a common tool to examine and optimize your code A helpful, tear-out cheat sheet is a quick reference for comparison symbols, conversion characters, mathematical doodads, C numeric data types, and more. C For Dummies takes the mystery out of programming and gets you into it quickly and painlessly.
Author(s): Dan Gookin
Series: For Dummies
Edition: 2
Publisher: For Dummies
Year: 2004
Language: English
Pages: 408
C For Dummies, 2nd Edition
About the Author
Contents at a Glance
Table of Contents
Introduction
“ What Will Understanding C Do for Me?”
About This Here Dummies Approach
How to Work the Examples in This Book
Foolish Assumptions
Icons Used in This Book
What’s New with This Edition?
Final Thots
Part I: Introduction to C Programming
Chapter 1: Up from the Primordial C
An Extremely Short and Cheap History of the C Language
The C Development Cycle
From Text File to Program
Save It! Compile and Link It! Run It!
Chapter 2: C of Sorrow, C of Woe
The Required Woes of Editing and Recompiling
Dealing with the Heartbreak of Errors
Chapter 3: C Straight
The Big Picture
C Language Pieces’ Parts
The C Language Itself — the Keywords
Other C Language Components
Pop Quiz!
The Helpful RULES Program
Chapter 4: C What I/O
Introduce Yourself to Mr. Computer
More on
Is Pronounced “ Scan-Eff”
Chapter 5: To C or Not to C
Adding Comments
Comment Styles of the Nerdy and Not-Quite-Yet-Nerdy
Using Comments to Disable
The Perils of “ Nested” Comments
Chapter 6: C More I/O with gets ( ) and puts ( )
The More I Want, the More I gets ( )
The Virtues of puts ( )
Part II: Run and Scream from Variables and Math
Chapter 7: A + B = C
The Ever-Changing Variable
Welcome to the Cold World of Numeric Variables
A Wee Bit o’ Math
Chapter 8: Charting Unknown Cs with Variables
Cussing, Discussing, and Declaring Variables
Constants and Variables
Chapter 9: How to C Numbers
There Are Numbers, and Then There Are Numbers
How to Make a Number Float
Bigger than the Float, It’s a Double!
Formatting Your Zeroes and Decimal Places
Chapter 10: Cook That C Variable Charred, Please
The Other Kind of Variable Type, the
Reading and Writing Single Characters
Character Variables As Values
Part III: Giving Your Programs the Ability to Run Amok
Chapter 11: C More Math and the Sacred Order of Precedence
An All-Too-Brief Review of the Basic C Mathematical Operators
The Delicate Art of Incrementation ( Or, “ Just Add One to It”)
The Sacred Order of Precedence
Chapter 12: C the Mighty if Command
If Only. . . .
If It Isn’t True, What Else?
Chapter 13: What If C==C?
The World of if without Values
Using the if Keyword to Compare Two Strings
Chapter 14: Iffy C Logic
Exposing Flaws in Logic
If, And, Or, But
Chapter 15: C You Again
For Going Loopy
I’m Bustin’ Outta Here!
Chapter 16: C the Loop, C the Loop++
The Art of Incrementation
The Mysterious Practice of Decrementation
More Incrementation Madness
Chapter 17: C You in a While Loop
The Lowdown on while Loops
Not to Beat a Dead Horse or Anything. . . .
Chapter 18: Do C While You Sleep
The Down-Low on Upside-Down do-while Loops
Nested Loops and Other Bird-Brained Concepts
Break the Brave and Continue the Fool
Chapter 19: Switch Case, or, From ‘ C’ to Shining ‘ c’
The Sneaky switch-case Loops
The switch-case Solution to the LOBBY Program
The Old switch-case Trick
The Special Relationship between while and switch-case
Part IV: C Level
Chapter 20: Writing That First Function
Meet Mr. Function
Prototyping Your Functions
The Tao of Functions
Chapter 21: Contending with Variables in Functions
Bombs Away with the BOMBER Program!
How We Can All Share and Love with Global Variables
Chapter 22: Functions That Actually Funct
Marching a Value Off to a Function
Sending More than One Value to a Function
Functions That Return Stuff
No Need to Bother with This C Language Trivia If You’re in a Hurry
Chapter 23: The Stuff That Comes First
Please Don’t Leave Me Out!
What the #defines Are Up To
Avoiding the Topic of Macros
Chapter 24: The printf( ) Chapter
A Quick Review of printf( )
The Old Displaying-Text-with-printf( ) Routine
The printf( ) Escape Sequences
The Complex printf( ) Format
The printf( )Conversion Characters
Chapter 25: Math Madness!
More on Math
Strange Math? You Got It!
Something Really Odd to End Your Day
Chapter 26: The Old Random-Number Function
On Being Random
The Diabolical Dr. Modulus
Rolling the Dice with the Final RANDOM Program
Part V: The Part of Tens
Chapter 27: Ten More Things You Need to Know about the C Language
Arrays
Strings
Structures
Pointers
Linked Lists
Binary Operators
Interacting with the Command Line
Disk Access
Interacting with the Operating System
Building Big Programs
Chapter 28: Ten Tips for the Budding Programmer
Use the Command-Line History
Keep Your Editor Open in Another Window
Use a Context-Colored Text Editor
Know the Line-Number Commands in Your Editor
Keep a Command Prompt Window Open If You’re Using the IDE
Know a Few Handy Command-Prompt Commands
Carefully Name Your Variables
Know Your Post-and Pre-Incrementing and Decrementing Riddles
Breaking Out of a Loop
Chapter 29: Ten Ways to Solve Your Own Programming Problems
Work on One Thing at a Time
Break Up Your Code
Simplify
Talk through the Program
Set Breakpoints
Monitor Your Variables
Document Your Work
Use Debugging Tools
Use a C Optimizer
Read More Books!
Appendix A: The Stuff You Need to Know before You Read All the Other Stuff in This Book
Setting Things Up
Making Programs
Appendix B: ASCII Table
Index