Home > Store

Sams Teach Yourself C in 21 Days, 6th Edition

Register your product to gain access to bonus material or receive a coupon.

Sams Teach Yourself C in 21 Days, 6th Edition

Premium Website

  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2003
  • Edition: 6th
  • Premium Website
  • ISBN-10: 0-672-32448-2
  • ISBN-13: 978-0-672-32448-2

In just 21 days, you'll have all the skills you need to get started with C. With this complete tutorial, you'll master the basics and them move on to the more advanced features and concepts.

  • Understand the fundamentals of C.
  • Master all the new and advanced features that C offers.
  • Learn how to effectively use the latest tools and features of C, by following practical, real-world examples.
  • Includes a CD with all code examples and an ANSI-compliant C compiler.

IMPORTANT NOTE: Windows XP or 32-bit Windows 7 recommended — will not run on 64-bit Windows systems!



Download free code files associated with Sams Teach Yourself C in 21 Days here

Sample Content

Online Sample Chapters

Storing Information: Variables and Constants

Storing Information: Variables and Constants in C

Table of Contents



Where You're Going.

Day 1. Getting Started with C.

A Brief History of the C Language. Why Use C? Preparing to Program. The Program Development Cycle. Your First C Program.

Type & Run 1. Printing Your Listings.

The First Type & Run.

Day 2. The Components of a C Program.

A Short C Program. The Program's Components. A Review of the Parts of a Program.

Day 3. Storing Information: Variables and Constants.

Understanding Your Computer's Memory. Storing Information with Variables. Numeric Variable Types. Constants.

Day 4. The Pieces of a C Program: Statements, Expressions, and Operators.

Statements. Understanding Expressions. Operators. The if Statement. Evaluating Relational Expressions. The Logical Operators. More on True/False Values. Operator Precedence Revisited.

Type & Run 2. Find the Number.
Day 5. Packaging Code in Functions.

What Is a Function? How a Function Works. Functions and Structured Programming. Writing a Function. Passing Arguments to a Function. Calling Functions. Where the Functions Belong. Working with Inline Functions.

Day 6. Basic Program Control.

Arrays: The Basics. Controlling Program Execution. Nested Loops.

Day 7. Fundamentals of Reading and Writing Information.

Displaying Information On-Screen. Inputting Numeric Data with scanf(). Using Trigraph Sequences.

Week 1 In Review.


Where You're Going.

Day 8. Using Numeric Arrays.

What Is an Array? Naming and Declaring Arrays.

Day 9. Understanding Pointers.

What Is a Pointer? Pointers and Simple Variables. Pointers and Variable Types. Pointers and Arrays. Pointer Cautions. Array Subscript Notation and Pointers. Passing Arrays to Functions.

Type & Run 3. Pausing for a Second or Two.
Day 10. Working with Characters and Strings.

The char Data Type. Using Character Variables. Using Strings. Strings and Pointers. Strings Without Arrays. Displaying Strings and Characters. Reading Strings from the Keyboard.

Day 11. Implementing Structures, Unions, and TypeDefs.

Working with Simple Structures. Using Structures That are More Complex. Arrays of Structures. Initializing Structures. Structures and Pointers. Understanding Unions. Creating Synonyms for Structures with typedef.

Day 12. Understanding Variable Scope.

What Is Scope? Creating External Variables. Creating Local Variables. Local Variables and the main() Function. Which Storage Class Should You Use? Local Variables and Blocks.

Type & Run 4. Secret Messages.
Day 13. Advanced Program Control.

Ending Loops Early. The goto Statement. Infinite Loops. The switch Statement. Exiting the Program. Executing Operating System Commands in a Program.

Day 14. Working with the Screen, Printer, and Keyboard.

Streams and C. Using C's Stream Functions. Accepting Keyboard Input. Controlling Output to the Screen. Redirecting Input and Output. When to Use fprintf().

Week 2 In Review.


Where You're Going.

Day 15. Pointers: Beyond the Basics.

Declaring Pointers to Pointers. Pointers and Multidimensional Arrays. Working with Arrays of Pointers. Working with Pointers to Functions. Bonus Section: Understanding Linked Lists.

Day 16. Using Disk Files.

Relating Streams to Disk Files. Understanding the Types of Disk Files. Using Filenames. Opening a File. Writing and Reading File Data. File Buffering: Closing and Flushing Files. Understanding Sequential Versus Random File Access. Detecting the End of a File. File Management Functions. Using Temporary Files.

Type & Run 5. Counting Characters.
Day 17. Manipulating Strings.

Determining String Length. Copying Strings. Concatenating Strings. Comparing Strings. Searching Strings. String Conversions. Miscellaneous String Functions. String-to-Number Conversions. Character Test Functions.

Day 18. Getting More from Functions.

Passing Pointers to Functions. Type void Pointers. Using Functions That Have a Variable Number of Arguments. Functions That Return a Pointer.

Day 19. Exploring the C Function Library.

Mathematical Functions. Dealing with Time. Error-Handling. Searching and Sorting.

Type & Run 6. Calculating Mortgage Payments.
Day 20. Working with Memory.

Type Conversions. Allocating Memory Storage Space. Manipulating Memory Blocks. Working with Bits.

Day 21. Advanced Compiler Use.

Programming with Multiple Source-Code Files. The C Preprocessor. Predefined Macros. Using Command-Line Arguments.

Week 3 In Review.


Where You're Going.

Bonus Day 1. Object-Oriented Programming Languages.

Procedural and Object-Oriented Languages. The Object-Oriented Constructs. The Java Programming Language. The C# Programming Language.

Bonus Day 2. The C++ Programming Language.

Hello C++ World! Understanding the C++ Keywords. The C++ Data Types. Declaring Variables in C++. Doing Operations in C++. Working with Functions in C++.

Bonus Day 3. Working with C++ Classes and Objects.

Working with Complex Data in C++. Using Classes. Creating Access Member Functions. Structures Versus Classes. Housekeeping with Classes. Starting with Constructors. Function Overloading Revisited. Review of the OOP Constructs in C++. Using Classes as Data Members. Inheriting in C++. A Caution on What You've Learned About C++.

Bonus Day 4. Java Language Fundamentals.

Structure of a Java Program. Java Program Essentials. Java Keywords. Java Identifiers. Data Types. Input and Output. Arrays. Operators. Flow Control.

Bonus Day 5. Working with Java Classes and Methods.

Defining a Class. Class Methods. Using Inheritance.

Bonus Day 6. More Java Techniques.

Working with Java Exceptions. Reading and Writing Files. Doing Graphics and Windows. Programming Java Applets.

Bonus Day 7. The C# Programming Language.

What Is C#? Why C#? C# Versus Other Programming Languages. Types of C# Programs. Creating a C# Program. Your First C# Program. Displaying Basic Information. C# and the Web.

Bonus Week. In Review.
Appendix A. ASCII Character Chart.
Appendix B. C/C++ Reserved Words.
Appendix C. Working with Binary and Hexadecimal Numbers

The Decimal Number System. The Binary System. The Hexadecimal System.

Appendix D. Portability Issues.

Guaranteeing ANSI Compatibility. Avoiding the ANSI Standard. Using Portable Numeric Variables. Portable Structures and Unions.

Appendix E. Common C Functions
Appendix F. Answers.
Appendix G. Getting Started with Dev-C++.

What is Dev-C++. Installing Dev-C++ on Microsoft Windows. The Dev-C++ Programs. Using Dev-C++.


More Information

Unlimited one-month access with your purchase
Free Safari Membership