Contents

Introduction

Part 1. First Steps with C

1. What Is C Programming?

Rewarding and Fun

What Is a Program?

What You Need to Write C Programs

The Programming Process

Using C

2. How Do I Get Started in C?

With the main() Function

Getting a Glimpse

The main() Function

Kinds of Data

C’s Characters

Numbers in C

In Review

3. How Do I Know What’s Happening?

Through Comments

Commenting on Your Code

Specifying Comments

White Space

The Future of Comments

In Review

4. Can I See Results?

With printf()

What printf() Does

The Format of printf()

Printing Strings

Escape Sequences

Conversion Characters

In Review

5. How Do I Store Stuff?

Using Variables

Kinds of Variables

Naming Variables

Defining Variables

Storing Data in Variables

In Review

6. Can C Store Words?

In Character Arrays

“I Am the String Terminator!”

The Length of Strings

Character Arrays: Lists of Characters

Initializing Strings

In Review

7. What Do #include and #define Mean?

They’re Preprocessor Directives

Including Files

Where Do I Put #include Directives?

Defining Constants

In Review

8. Can I Ask the User Questions?

With scanf()

Looking at scanf()

Prompting for scanf()

Problems with scanf()

In Review

9. How Does C Do Math?

With Operators

The Basics

Order of Operators

Break the Rules with Parentheses

Assignments Everywhere

In Review

Part 2. The Operating Room

10. What Else Can I Do with Expressions?

Combine Operators and Give Typecasts

Compound Assignment

Watch That Order!

Typecasting: Hollywood Could Take Lessons from C

In Review

11. Can I Compare Two Values?

With Relational Operators

Testing Data

Using if

Otherwise...: Using else

In Review

12. How Do I Test Several Things at Once?

With Logical Operators

Getting Logical

The Order of Logical Operators

In Review

13. Are There More Operators?

Additional C Operators

Goodbye if-else; Hello Conditional

The Small-Change Operators: ++ and --

Sizing Up the Situation

In Review

Part 3. Keeping Control

14. How Can I Do the Same Stuff Over and Over?

With while and do-while Loops

while We Repeat

Using while

Using do-while

In Review

15. Are There Other Loops?

The for Loop

for Repeat’s Sake!

Working with for

In Review

16. What if I Want to Stop in the Middle of a Loop?

Use break and continue

Take a break

Let’s continue Working

In Review

17. How Can I Test Lots of Values?

With the switch Statement

Making the switch

break and switch

Efficiency Considerations

In Review

18. How Else Can I Control Input and Output?

With Built-In I/O Functions

putchar() and getchar()

The Newline Consideration

A Little Faster: getch()

In Review

19. Can You Tell Me More About Strings?

C’s Built-In Character and String Functions

Character-Testing Functions

Is the Case Correct?

Case-Changing Functions

String Functions

In Review

20. Can C Do My Math Homework?

The Built-In Numeric Functions Show You

Practicing Your Math

Doing More Conversions

Getting Into Trig and Other Really Hard Stuff

Getting Random

In Review

Part 4. C Programs and Lots of Data

21. How Does C Work with Lists?

Using Arrays

Reviewing Arrays

Putting Values in Arrays

We’re Not Done Yet

In Review

22. How Can I Search for Data?

Step Through Arrays

Filling Arrays

Finders Keepers

In Review

23. How Can I Arrange and Alphabetize?

The Bubble Sort Does the Trick

Putting Your House in Order: Sorting

Faster Searches

In Review

24. What’s the Point?

Using Pointers, You’ll Find Out

Memory Addresses

Defining Pointer Variables

Using the Dereferencing *

In Review

25. How Are Arrays and Pointers Different?

They’re the Same Thing in C

Array Names Are Pointers

Getting Down in the List

Characters and Pointers

Be Careful with Lengths

Arrays of Pointers

In Review

26. Where’s More Memory?

Try the Heap

Thinking of the Heap

But WHY Do I Need the Heap?

How Do I Allocate the Heap?

If There’s Not Enough Heap Memory

Freeing Heap Memory

Multiple Allocations

In Review

27. How Do I Store Lots of Data?

With Structures

Defining a Structure

Putting Data in Structure Variables

In Review

Part 5. Form Follows Functions

28. Can My Programs Save Stuff on Disk?

With Sequential Files

Disk Files

Opening a File

Using Sequential Files

In Review

29. Is There Another Way to Save Files?

Use Random Files

Opening Random Files

Moving Around in a File

In Review

30. How Can I Better Organize My Programs?

Using Functions

Form Follows C Functions

Local or Global?

In Review

31. How Do Functions Share Data?

By Passing Variables

Passing Arguments

Methods of Passing Arguments

Passing by Value

Passing by Address

In Review

32. How Can I Perfect My Functions?

Using Return Values and Prototypes

Returning Values

The Return Data Type

One Last Step: Prototype

Wrapping Things Up

In Review

A. Where Do I Go from Here?

Teach Yourself C in 21 Days

Advanced C

Moving from C to C++

C++ Programming 101

Turbo C++ Programming 101

Advanced C++

B. Playing Around with C Blackjack

C. The ASCII Table

Index

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.23.123