+612 9045 4394
C Programming : A Modern Approach - K. N. King

C Programming

A Modern Approach

Paperback Published: 31st March 2008
ISBN: 9780393979503
Number Of Pages: 860

Share This Book:


or 4 easy payments of $38.49 with Learn more
Ships in 5 to 9 business days

Professor King's spiral approach made it accessible to a broad range of readers, from beginners to more advanced students. With adoptions at over 225 colleges, the first edition was one of the leading C textbooks of the last ten years. The second edition maintains all the book's popular features and brings it up to date with coverage of the C99 standard. The new edition also adds a significant number of exercises and longer programming projects, and includes extensive revisions and updates.

1. Introducing C
1.1 History of C

1.2 Strengths and Weaknesses of C

Effective Use of C
2. C Fundamentals
2.1 Writing a Simple Program

PROGRAM: Printing a Pun
Compiling and Linking
2.2 The General Form of a Simple Program

Printing Strings
2.4 Variables and Assignment

Printing the Value of a Variable
PROGRAM: Computing the Dimensional Weight of a Box
Printing Expressions
2.5 Reading Input

PROGRAM: Computing the Dimensional Weight of a Box (Revisited)
2.6 Defining Constants

PROGRAM: Converting from Fahrenheit to Celsius
2.7 Identifiers

2.8 Layout of a C Program
3. Formatted Input/Output
3.1 The printf Function

Conversion Specifications
PROGRAM: Using printf to Format Numbers
Escape Sequences
3.2 The scanf Function

How scanf Works
Ordinary Characters in Format Strings
Confusing printf with scanf
PROGRAM: Computing the Value of Stock Holdings
4. Expressions

4.1 Arithmetic Operators
Operator Precedence and Associativity
PROGRAM: Computing a UPC Check Digit
4.2 Assignment Operators

Simple Assignment
Compound Assignment
4.3 Increment and Decrement Operators
4.4 Expression Evaluation

Order of Subexpression Evaluation
4.5 Expression Statements
5 Selection Statements
5.1 Logical Expressions

Relational Operators
Equality Operators
Logical Operators
5.2 The if Statement

Compound Statements
The else Clause
Cascaded if Statements
PROGRAM: Calculating a Broker's Commission
The 'Dangling else' Problem
Conditional Expressions
Boolean Values
5.3 The switch Statement

The Role of the break Statement
PROGRAM: Printing a Date in Legal Form
6. Loops
6.1 The while Statement

Infinite Loops
PROGRAM: Printing a Table of Squares
PROGRAM: Summing a Series of Numbers
6.2 The do Statement

PROGRAM: Calculating the Number of Digits in an Integer
6.3 The for Statement

for Statement Idioms
Omitting Expressions in a for Statement
The Comma Operator
PROGRAM: Printing a Table of Squares (Revisited)
6.4 Exiting from a Loop

The break Statement
The continue Statement
The goto Statement
PROGRAM: Balancing a Checkbook
6.5 The Null Statement
7. Basic Types
7.1 Integer Types

Integer Constants
Reading and Writing Integers
PROGRAM: Summing a Series of Numbers (Revisited)
7.2 Floating Types

Floating Constants
Reading and Writing Floating-Point Numbers
7.3 Character Types

Escape Sequences
Character-Handling Functions
Reading and Writing Characters
PROGRAM: Determining the Length of a Message
7.4 The sizeof Operator
7.5 Type Conversion

The Usual Arithmetic Conversions
Conversion During Assignment
7.6 Type Definitions
8. Arrays
8.1 One-Dimensional Arrays

Array Subscripting
PROGRAM: Reversing a Series of Numbers
Array Initialization
PROGRAM: Checking a Number for Repeated Digits
Using the sizeof Operator with Arrays
PROGRAM: Computing Interest
8.2 Multidimensional Arrays

Initializing a Multidimensional Array
Constant Arrays
PROGRAM: Dealing a Hand of Cards
9. Functions
9.1 Defining and Calling Functions

PROGRAM: Computing Averages
PROGRAM: Printing a Countdown
PROGRAM: Printing a Pun (Revisited)
Function Definitions
Function Calls
PROGRAM: Testing Whether a Number Is Prime
9.2 Function Declarations
9.3 Arguments

Argument Conversions
Array Arguments
9.4 The return Statement

The exit Function
9.6 Recursive Functions

The Quicksort Algorithm
PROGRAM: Quicksort
10. Program Organization
10.1 Local Variables

10.2 External Variables

Example: Using External Variables to Implement a Stack
Pros and Cons of External Variables
PROGRAM: Guessing a Number
10.3 Blocks
10.4 Scope
10.5 Organizing a C Program

PROGRAM: Classifying a Poker Hand
11. Pointers
11.1 Pointer Variables

Declaring Pointer Variables
11.2 The Address and Indirection Operators

The Address Operator
The Indirection Operator
11.3 Pointer Assignment
11.4 Pointers as Arguments

PROGRAM: Finding the Largest and Smallest Elements in an Array
Using const to Protect Arguments
11.5 Pointers as Return Values
12. Pointers and Arrays
12.1 Pointer Arithmetic

Adding an Integer to a Pointer
Subtracting an Integer from a Pointer
Subtracting Pointers
Comparing Pointers
12.2 Using Pointers for Array Processing

Combining the * and ++ Operators
12.3 Using an Array Name as a Pointer

PROGRAM: Reversing a Series of Numbers (Revisited)
Array Arguments (Revisited)
Using a Pointer as an Array Name
12.4 Pointers and Multidimensional Arrays

Processing the Elements of a Multidimensional Array
Processing the Rows of a Multidimensional Array
Using the Name of a Multidimensional Array as a Pointer
13. Strings
13.1 String Literals

Escape Sequences in String Literals
Continuing a String Literal
How String Literals Are Stored
Operations on String Literals
String Literals versus Character Constants
13.2 String Variables

Initializing a String Variable
Character Arrays versus Character Pointers
13.3 Reading and Writing Strings

Writing Strings Using printf and puts
Reading Strings Using scanf and gets
Reading Strings Character by Character
13.4 Accessing the Characters in a String
13.5 Using the C String Library

The strcpy (String Copy) Function
The strcat (String Concatenate) Function
The strcmp (String Compare) Function
The strlen (String Length) Function
PROGRAM: Printing a One-Month Reminder List
13.6 String Idioms

Searching for the End of a String
Copying a String
13.7 Arrays of Strings

Command-Line Arguments
PROGRAM: Checking Planet Names
14. The Preprocessor
14.1 How the Preprocessor Works
14.2 Preprocessor Directives
14.3 Macro Definition

Simple Macros
Parameterized Macros
The # Operator
The ## Operator
General Properties of Macros
Parentheses in Macro Definitions
Creating Longer Macros
Predefined Macros
14.4 Conditional Compilation

The #if and #endif Directives
The defined Operator
The #ifdef and #ifndef Directives
The #elif and #else Directives
Uses of Conditional Compilation
14.5 Miscellaneous Directives

The #error Directive
The #line Directive
The #pragma Directive
15. Writing Large Programs
15.1 Source Files
15.2 Header Files

The #include Directive
Sharing Macro Definitions and Type Definitions
Sharing Function Prototypes
Sharing Variable Declarations
Nested Includes
Protecting Header Files
#error Directives in Header Files
15.3 Dividing a Program into Files

PROGRAM: Text Formatting
15.4 Building a Multiple-File Program

Errors During Linking
Rebuilding a Program
Defining Macros Outside a Program
16. Structures, Unions, and Enumerations
16.1 Structure Variables

Declaring Structure Variables
Initializing Structure Variables
Operations on Structures
16.2 Structure Types

Declaring a Structure Tag
Defining a Structure Type
Structures as Arguments and Return Values
16.3 Nested Arrays and Structures

Nested Structures
Arrays of Structures
Initializing an Array of Structures
PROGRAM: Maintaining a Parts Database
16.4 Unions

Using Unions to Save Space
Using Unions to Build Mixed Data Structures
Adding a "Tag Field" to a Union
16.5 Enumerations

Enumeration Tags and Types
Enumerations as Integers
Using Enumerations to Declare "Tag Fields"
17. Advanced Uses of Pointers
17.1 Dynamic Storage Allocation

Memory Allocation Functions
Null Pointers
17.2 Dynamically Allocated Strings

Using malloc to Allocate Memory for a String
Using Dynamic Storage Allocation in String Functions
Arrays of Dynamically Allocated Strings
PROGRAM: Printing a One-Month Reminder List (Revisited)
17.3 Dynamically Allocated Arrays

Using malloc to Allocate Storage for an Array
The calloc Function
The realloc Function
17.4 Deallocating Storage

The free Function
The "Dangling Pointer" Problem
17.5 Linked Lists

Declaring a Node Type
Creating Nodes
The -> Operator
Inserting a Node at the Beginning of a Linked List
Searching a Linked List
Deleting a Node from a Linked List
Ordered Lists
PROGRAM: Maintaining a Parts Database (Revisited)
17.6 Pointers to Pointers
17.7 Pointers to Functions

Function Pointers as Arguments
The qsort Function
PROGRAM: Tabulating the Trigonometric Functions
8. Declarations
18.1 Declaration Syntax
18.2 Storage Classes

Properties of Variables
The auto Storage Class
The extern Storage Class
The register Storage Class
18.3 Type Qualifiers
18.4 Declarators

Deciphering Complex Declarations
Using Type Definitions to Simplify Declarations
18.5 Initializers

Uninitialized Variables
19. Program Design
19.1 Modules

Cohesion and Coupling
Types of Modules
19.2 Information Hiding

A Stack Module
19.3 Abstract Data Types

19.4 C++

Differences between C and C++
Class Definitions
Member Functions
Constructors and Dynamic Storage Allocation
Object-Oriented Programming
Virtual Functions
Exception Handling
20. Low-Level Programming
20.1 Bitwise Operators

Bitwise Shift Operators
Bitwise Complement, And, Exclusive Or, and Inclusive Or
Using the Bitwise Operators to Access Bits
Using the Bitwise Operators to Access Bit-Fields
PROGRAM: XOR Encryption
20.2 Bit-Fields in Structures

How Bit-Fields Are Stored
20.3 Other Low-Level Techniques

Defining Machine-Dependent Types
Using Unions to Provide Multiple Views of Data
Using Pointers as Addresses
PROGRAM: Toggling the Num Lock Key
The volatile Type Qualifier
21. The Standard Library
21.1 Using the Library

Restrictions on Names Used in the Library
Functions Hidden by Macros
21.2 Library Overview
21.3 The Header: Common Definitions
22. Input/Output
22.1 Streams

File Pointers
Standard Streams and Redirection
Text Files versus Binary Files
22.2 File Operations

Opening a File
Closing a File
Attaching a File to a Stream
btaining File Names from the Command Line
PROGRAM: Checking Whether a File Can Be Opened
Temporary Files
File Buffering
Miscellaneous File Operations
22.3 Formatted I/O

The ...printf Functions
...printf Conversion Specifications
Examples of ...printf Conversion Specifications
The ...scanf Functions
...scanf Format Strings
...scanf Conversion Specifications
scanf Examples
Detecting End-of-File and Error Conditions
22.4 Character I/O

Output Functions
Input Functions
PROGRAM: Copying a File
22.5 Line I/O

Output Functions
Input Functions
22.6 Block I/O

22.7 File Positioning
PROGRAM: Modifying a File of Part Records
22.8 String I/O
23. Library Support for Numbers and Character Data
23.1 The Header: Characteristics of Floating Types
23.2 The Header: Sizes of Integral Types
23.3 The Header: Mathematics

Trigonometric Functions
Hyperbolic Functions
Exponential and Logarithmic Functions
Power Functions
Nearest Integer, Absolute Value, and Remainder Functions
23.4 The Header: Character Handling

Character-Testing Functions
PROGRAM: Testing the Character-Testing Functions
Character Case-Mapping Functions
PROGRAM: Testing the Case-Mapping Functions
23.5 The Header: String Handling

Copying Functions
Concatenation Functions
Comparison Functions
Search Functions
Miscellaneous Functions
24. Error Handling
24.1 The Header: Diagnostics
24.2 The Header: Errors

The perror and strerror Functions
24.3 The Header: Signal Handling

Signal Macros
The signal Function
Predefined Signal Handlers
The raise Function
PROGRAM: Testing Signals
24.4 The Header: Nonlocal Jumps

PROGRAM: Testing setjmp/longjmp
25. International Features
25.1 The Header: Localization

The setlocale Function
The localeconv Function
25.2 Multibyte Characters and Wide Characters

Multibyte Characters
Wide Characters
Multibyte Character Functions
Multibyte String Functions
25.3 Trigraph Sequences
26 Miscellaneous Library Functions
26.1 The Header: Variable Arguments

Calling a Function with a Variable Argument List
The ...vprintf Functions
26.2 The Header: General Utilities

String Conversion Functions
PROGRAM: Testing the String Conversion Functions
Pseudo-Random Sequence Generation Functions
PROGRAM: Testing the Pseudo-Random Sequence Generation Functions
Communication with the Environment
Searching and Sorting Utilities
PROGRAM: Determining Air Mileage
Integer Arithmetic Functions
26.3 The Header: Date and Time

Time Manipulation Functions
Time Conversion Functions
PROGRAM: Displaying the Date and Time

ISBN: 9780393979503
ISBN-10: 0393979504
Audience: Tertiary; University or College
Format: Paperback
Language: English
Number Of Pages: 860
Published: 31st March 2008
Publisher: WW Norton & Co
Country of Publication: US
Dimensions (cm): 19.0 x 23.6  x 2.8
Weight (kg): 1.17
Edition Number: 2
Edition Type: Revised