Advanced C

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Here's the next step for programmers who want to improve their C programming skills.
-- Complete coverage of disk files including sequential access, text, binary, and random access
-- Efficient tips and techniques for debugging C programs

Author(s): Peter D. Hipson
Year: 1992

Language: English
Pages: 850

Contents
Introduction
Part I Honing Your C Skills
1 The C Philosophy
A Brief History of C and the Standard
A Programming Style
Memory Models
Summary
2 Data Types, Constants, Variables, and Arrays
Data Types
Constants
Definitions versus Declarations
Declarations
Definitions
Variables
Variable Types and Initializing Variables
Scope (Or I Can See You)
Life Span (Or How Long Is It Going To Be Here?)
Type Casting
Arrays
Declaration of Arrays
Definition of an Array
Array Indexing
Using Array Names as Pointers
Strings: Character Arrays
Using Arrays of Pointers
Summary
3 Pointers and Indirection
Pointers, Indirection, and Arrays
Pointers
Indirection
An Example of Pointers, Indirection, and Arrays
Character Arrays and Strings
Indirection to Access Character Strings
Protecting Strings in Memory
Ragged-Right String Arrays
Summary
4 Special Pointers and Their Use
Command Line Arguments
Function Pointers
Menus and Pointers
State Machines
Summary
5 Decimal, Binary, Hex and Octal
Decimal
Binary
Hex
Octal
Looking at a File
Bit Operators
Bit Fields
Summary
6 Separate Compilation and Linking
Compiling and Linking Multiple Source Files
Compiling Multifile Programs
Linking Multifile Programs
Using #include
External Variables
Using an Object Library Manager
Using MAKE Files
Summary
Part II Managing Data in C
7 C Structures
Using the struct Keyword
Arrays of Structures
Structures of Arrays
Structures of Structures
Bit Fields in Structures
Using the typedef Keyword
Using the offsetof() Macro
Pointers to Structures
Understanding unions
Summary
8 Dynamic Memory Allocation
Using the malloc() Function
Using the calloc() Function
Using the free() Function
Using the realloc() Function
Allocating Arrays
Global Memory versus Local Memory
Summary
9 Disk Files and Other I/O
File I/O Basics
Text Files and Binary Files
Creating and Using Temporary Work Files
Stream Files and Default File Handles
The stdin File
The stdout File
The stderr File
The stdaux File
The stdprn File
Low-Level I/O and File Handles
Standard Low-Level File Handles
Console and Port I/O
Direct Port I/O
The PC Printer Ports
The PC Communications Ports
Summary
10 Data Management: Sorts, Lists, and Indexes
Sorting
Merging
Purging
Sorting, Merging, and Purging All in One
Linked Lists
Using Dynamic Memory
Disk-Based Lists
Double Linked Lists
Indexing
Fixed-field Disk Files
B-trees
Summary
Part III Working with Others
11 C and Other Languages
Other Languages
Assembly
FORTRAN
Pascal
BASIC
Calling Other Languages from C
Calling Assembly from C
Calling FORTRAN and Pascal from C
Calling C Functions from Other Languages
Calling C from Assembly
Calling C from FORTRAN and Pascal
All the Things that Can Go Wrong
Looking at Data
Names and Limits
Summary
12 C and Databases
Interfacing with dBASE-Compatible Programs
Using dBASE Files Directly
Reading dBASE and dBASE-Compatible Files
Creating dBASE and dBASE-Compatible Files
Updating dBASE and dBASE-Compatible Files
Summary
13 All About Header Files
Function Prototypes
The ANSI C Header Files
The assert.h File (ANSI)
The ctype.h File (ANSI)
The errno.h File (ANSI)
The float.h File (ANSI)
The io.h File
The limits.h File (ANSI)
The locale.h File (ANSI)
The malloc.h File
The math.h File (ANSI)
The memory.h File
The search.h File
The setjmp.h File (ANSI)
The signal.h File (ANSI)
The stdarg.h File (ANSI)
The stddef.h File (ANSI)
The stdio.h File (ANSI)
The stdlib.h File (ANSI)
String Conversion
Memory Allocation
Random Numbers
Communications with the Operating System
Search Functions
Integer Math
Multibyte Characters
The string.h File (ANSI)
The time.h File (ANSI)
The varargs.h File
Summary
Part IV Documenting the Differences
14 ANSI C’s Library Functions
Functions
printf() Format Codes
scanf() format codes
Summary
15 Preprocessor Directives
The Macro Continuation Operator (\)
The Stringize Operator (#)
The Characterize Operator (#@)
The Token Paste Operator (##)
The Defined Identifier Operator (defined())
The #define Directive
The #error Directive
The #include Directive
The #if Directive
The #ifdef Directive
The #ifndef Directive
The #else Directive
The #elif Directive
The #endif Directive
The #line Directive
The #pragma Directive
The message Pragma
The pack Pragma
The #undef Directive
Predefined Macros
The _ _DATE_ _Macro
The _ _TIME_ _Macro
The_ _FILE_ _Macro
The_ _LINE_ _Macro
The_ _STDC_ _Macro
NULL
The offsetof() Macro
Summary
16 Debugging and Efficiency
Debugging
Common Bugs
Rules for Debugging
Using the assert() Macro
Debug Strings and Messages
Debuggers
Efficiency
32-Bit Programs
Compiler Optimization
Direct Video I/O
Floating-Point Optimization
Inline Assembly
Linking for Performance
Pascal and cdecl Calling Conventions
Precompiled Headers
Using 80286/80386/80486 Instruction Sets
Using a Source Profiler
Using Intrinsic Functions
Using Memory Models
Summary
Part V Appenidces
A The ASCII Character Set
B Compiler Variations
C Introduction to C++
D Function/Header File Cross Reference
Index