PTG home
Catalog Search:
Search
Related Topics:
COMPUTING
Programming Languages
C




 
C for Java Programmers 1/e

Tomasz Muldner

Published March 2000 by Addison-Wesley
Copyright 2000, 500 pp., Paper
ISBN: 0-201-70279-7
List Price:
$52.60

Inventory Status:
In-Stock
   
Summary

The C programming language has been around for over 25 years. Lately, however, more and more programmers are learning Java as their first language. While Java offers many advantages, C is more efficient and appropriate when working with certain run-time applications, compilers, graphics and operating systems.

With C for Java Programmers, Tomasz M,ldner adopts an innovative approach modern ANSI C techniques to readers already familiar the Java concepts. He takes advantage of the techniques and underlying design principles present in object-oriented languages like Java and incorporates them to create a set of programming standards applicable to C. These standards are present throughout each chapter both in short examples and in longer modules. C for Java Programmers centers around such vital concepts as the ability to extend and modify modules, represent enumerations, create concrete and generic modules, and use shallow and deep copying of data elements. In addition, this book provides a thorough discussion of issues such as memory management, pointer use, and exception handling--topics traditionally more troublesome for novice C programmers--which become increasingly important in the less-protected world of C.

0201702797B04062001

Features

  • Presents low- and high-level C constructs, acting both as an introduction to the language and as a language reference
  • Introduces a set of programming and portability standards, as well as lists of coding idioms and common errors, to reinforce use of good design principles
  • Provides numerous sample programs and end-of-chapter exercises to enhance understanding


Author Bio

Tomasz M,ldner is a professor of computer science at Acadia University in Nova Scotia, one of Canada's top undergraduate universities. He is the recipient of numerous teaching awards, including the prestigious Acadia University Alumni Excellence in Teaching Award in 1996. He has over 20 years of experience working with C and UNIX, and in 1988 co-authored the book C as a Second Language. His research interests include distributed object-oriented programming, mobile agents, and collaborative applications. Dr. M,ldner received his Ph.D. in mathematics from the Polish Academy of Science in Warsaw, Poland in 1975.

0201702797AB04062001

Table of Contents



Preface.


1. Introduction.

Preview.

About C.

Object-Oriented versus Procedural Programming.

A Brief Comparison of C and Java.

Why is C Still Useful?

Development Process.

Compilation, Linking, and Preprocessing.

Portability, Efficiency, and Correctness.

Programming Style.

Programming with Idioms.



2. Example of a C Program.

General Documentation.

Run-Time Libraries and Function Declarations.

Global Definitions.

User-Defined Functions.

The main Function.

Sample Output.



3. Lexical Structure, Primitive Data Types, and Terminal I/0.

Preview.

Lexical Structure.

Alphabet.

Comments.

Trigraphs.

Line Structure.

Tokens.

Identifiers.

Keywords.

Primitive Data Types and Declarations.

Primitive Data Types.

Declarations of Variables and Constants.

Assignment.

The main Program.

Constants.

Integer Constants.

Floating-Point Constants.

Character Constants.

String Constants.

Expressions.

Terminal Input/Output.

Single Character I/O.

Formatted I/O.

Type Conversions.

sizeof.

Conversions.

Type Synonyms: typedef.

List of Common Errors.

List of Idioms.

List of Programming Style Guidelines.

List of Portability Guidelines.

Exercises.



4. Control Structures.

Preview.

Logical Expressions.

Control Statements and Their Idiomatic Use.

Testing and Debugging.

Loops.

List of Common Errors.

List of Idioms.

List of Programming Style Guidelines.

Exercises.



5. Text Files.

Preview.

Introduction.

File Handles.

Opening and Closing Files.

Basic File I/O Operations.

Testing for End-of-Line and End-of-File.

Handling Errors.

List of Common Errors.

List of Idioms.

Exercises.



6. The C Preprocessor.

Preview.

Introduction.

Macros.

Parameterless Macros.

Predefined Macros.

Macros with Parameters.

Undefining and Redefining Macros.

File Inclusion.

Conditional Compilation.

Debugging.

Header Files: Part 1.

Portability.

Line Numbering.

List of Common Errors.

List of Idioms.

List of Programming Style Guidelines.

Exercises.



7. Functions, Scope, and Introduction to Module-Based Programming.

Preview.

Functions and Their Documentation.

Declarations and Definitions.

Functions and Void.

Type Conversion.

The exit Function.

Scope.

Blocks.

Global Variables.

Storage Classes and Lifetime.

Initialization of Variables.

Module-Based Programming: Part 1.

Design for Change.

Sharing Functions and Variables: extern.

Linkage and the static Keyword.

Header Files: Part 2.

Encapsulation.

Using Modules.

Types of Modules.

Overloading Functions: Variable Number of Arguments.

List of Common Errors.

List of Idioms.

List of Programming Style Guidelines.

Exercises.



8. Pointers and Their Applications.

Preview.

Stack and Heap Based Memory.

Basic Terminology.

Declaring and Casting Pointers.

Dereferencing Pointers and the Address Operator.

Pointer Assignments.

Qualified Pointers.

Generic Pointers and NULL.

Pointer Conversions.

Standard Type Definitions.

Heap Memory Management.

Memory Allocation.

Memory Deallocation.

Pointer Arithmetic.

The Sum of a Pointer and an Integer.

Difference of a Pointer and an Integer.

Pointer Comparison: , <W0=>, , =, ==, !=.

Pointer Subtraction.

Working with Memory Blocks.

File I/O for Memory Blocks: Binary Files.

Current File Position.

Binary Reading and Writing.

Pointers and Functions.

Pointer Parameters.

Protecting Return Values and Parameter Values: const.

The Dangling Reference Problem.

Overriding Functions: Pointers to Functions and Functions as Parameters.

Reusability of Functions: Generic Pointers.

Declarators: Part 1.

Pointers to Blocks Containing Pointers.

Module-Based Programming: Part 2.

Basic Terminology.

Homogenous Collection of Objects.

Pure Modules: Enumeration.

Homogenous Concrete Modules.

Heterogeneous Data Structures.

List of Common Errors.

List of Idioms.

List of Programming Style Guidelines.

List of Portability Guidelines.

Exercises.



9. Strings.

Preview.

Character Processing Functions.

Strings in C.

Definitions of Strings and String Constants.

Strings, Parameters, and Return Values.

Formatted String I/0.

Line-Oriented String I/0.

C String Operations.

Length.

Copying.

Comparisons.

Search.

Processing Tokens.

String-to-Number Conversions.

Standard Error Handling.

Module for String Tokenizing.

Main Function's Arguments.

List of Common Errors.

List of Idioms.

Exercises.



10. Arrays.

Preview.

Single-Dimensional Arrays.

Arrays as Parameters.

Array Initialization and Storage.

Declarators: Part 2.

Multi-Dimensional Arrays.

Dynamic Array Module (with Preconditions).

Testing Preconditions.

Interface.

Application.

Implementation.

List of Common Errors.

List of Idioms.

List of Programming Style Guidelines.

Exercises.



11. Structures and Their Applications.

Preview.

Structures and Classes.

Declaring and Using Structures.

Nested Structures and Incomplete Definitions.

Assigning and Comparing Structures.

Structures and Other Constructs.

Structures and Pointers.

Structures and Functions.

Blocks of Structures and Pointers to Structures.

Structures and Arrays.

Initialization of Structures.

Structures and Pointers to Functions.

Structures and Header Files.

Binary Files: Part 2.

Introduction to Linked Lists.

Module-Based Programming: Part 3.

Implementation of Opaque Types.

Enumerations.

Generic Dynamic Array Module with Enumerations.

List Module.

List of Common Errors.

List of Idioms.

List of Programming Style Guidelines.

List of Portability Guidelines.

Exercises.



12. Enumerated Types and Unions.

Preview.

Enumerated Types.

Unions.

List of Idioms.

List of Programming Style Guidelines.

Exercises.



13. Bitwise Operations and Bit Fields.

Preview.

Bitwise Operations.

Bit Fields.

List of Portability Guidelines.

Exercises.



14. Module-Based Programming: Finale.

Preview.

Error Handling.

Long Jumps.

Exception Handling.

Characterization of Modules.

Shallow and Deep Interfaces.

Lists.

Conclusion.

Exercises.



Appendix A: Precedence and Associativity Tables.


Appendix B: Summary of All Standard Library Functions.

B.1 Formatted Input.

B.2 Formatted Output.



Appendix C: Glossary.


Appendix D: The Complete List of Common Errors.

Chapter 3.

Chapter 4.

Chapter 5.

Chapter 6.

Chapter 7.

Chapter 8.

Chapter 9

Chapter 10.

Chapter 1.



Appendix E: The Complete List of Idioms.

Chapter 3.

Chapter 4.

Chapter 5.

Chapter 6.

Chapter 7.

Chapter 8.

Chapter 9.

Chapter 10.

Chapter 1.

Chapter 12.



Appendix F. The Complete List of Programming Style Guidelines.

Chapter 3.

Chapter 4.

Chapter 6.

Chapter 7.

Chapter 8.

Chapter 10.

Chapter 1.

Chapter 12.



Appendix G: The Complete List of Portability.

Guidelines.

Chapter 3.

Chapter 8.

Chapter 1.

Chapter 13.



Appendix H: Cross Reference Index of Useful Code

Fragments.



References.


Index.



back to top