The C programming language

l  Introduction
1. Chapter 1: A Tutorial Introduction
1. Getting Started
2. Variables and Arithmetic Expressions
3. The for statement
4. Symbolic Constants
5. Character Input and Output
1. File Copying
2. Character Counting
3. Line Counting
4. Word Counting
6. Arrays
7. Functions
8. Arguments – Call by Value
9. Character Arrays
10. External Variables and Scope
2. Chapter 2: Types, Operators and Expressions
1. Variable Names
2. Data Types and Sizes
3. Constants
4. Declarations
The C programming Language
5. Arithmetic Operators
6. Relational and Logical Operators
7. Type Conversions
8. Increment and Decrement Operators
9. Bitwise Operators
10. Assignment Operators and Expressions
11. Conditional Expressions
12. Precedence and Order of Evaluation
3. Chapter 3: Control Flow
1. Statements and Blocks
2. If-Else
3. Else-If
4. Switch
5. Loops – While and For
6. Loops – Do-While
7. Break and Continue
8. Goto and labels
4. Chapter 4: Functions and Program Structure
1. Basics of Functions
2. Functions Returning Non-integers
3. External Variables
4. Scope Rules
5. Header Files
6. Static Variables
7. Register Variables
8. Block Structure
9. Initialization
10. Recursion
11. The C Preprocessor
1. File Inclusion
2. Macro Substitution
3. Conditional Inclusion
5. Chapter 5: Pointers and Arrays
1. Pointers and Addresses
2. Pointers and Function Arguments
The C programming Language
3. Pointers and Arrays
4. Address Arithmetic
5. Character Pointers and Functions
6. Pointer Arrays; Pointers to Pointers
7. Multi-dimensional Arrays
8. Initialization of Pointer Arrays
9. Pointers vs. Multi-dimensional Arrays
10. Command-line Arguments
11. Pointers to Functions
12. Complicated Declarations

Preface

The computing world has undergone a revolution since the publication of The C Programming Language in 1978. Big computers are much bigger, and personal computers have capabilities that rival mainframes  of a decade ago. During this time, C has changed too, although only modestly, and it has spread far  beyond its origins as the language of the UNIX operating system.
The growing popularity of C, the changes in the language over the years, and the creation of compilers  by groups not involved in its design, combined to demonstrate a need for a more precise and more  contemporary definition of the language than the first edition of this book provided. In 1983, the  American National Standards Institute (ANSI) established a committee whose goal was to produce  an  unambiguous and machine-independent definition of the language C », while still retaining its spirit. The  result is the ANSI standard for C.

Preface to the first edition

C is a general-purpose programming language with features economy of expression, modern flow control and data structures, and a rich set of operators. C is not a very high level » language, nor a « big » one,and is not specialized to any particular area of application. But its absence of restrictions and its   generality make it more convenient and effective for many tasks than supposedly more powerful  languages.
C was originally designed for and implemented on the UNIX operating system on the DEC PDP-11, by  Dennis Ritchie. The operating system, the C compiler, and essentially all UNIX applications programs  (including all of the software used to prepare this book) are written in C. Production compilers also exist for several other machines, including the IBM System/370, the Honeywell 6000, and the Interdata 8/32.
C is not tied to any particular hardware or system, however, and it is easy to write programs that will run  without change on any machine that supports C.

LIRE AUSSI :  Cours et TP de langage C++ les fonctions

Introduction

C is a general-purpose programming language. It has been closely associated with the UNIX operating  system where it was developed, since both the system and most of the programs that run on it are written  in C. The language, however, is not tied to any one operating system or machine; and although it has  been called a « system programming language » because it is useful for writing compilers and operating  systems, it has been used equally well to write major programs in many different domains.
Many of the important ideas of C stem from the language BCPL, developed by Martin Richards. The  influence of BCPL on C proceeded indirectly through the language B, which was written by Ken  Thompson in 1970 for the first UNIX system on the DEC PDP-7.
BCPL and B are « typeless » languages. By contrast, C provides a variety of data types. The fundamental  types are characters, and integers and floating point numbers of several sizes. In addition, there is a  hierarchy of derived data types created with pointers, arrays, structures and unions. Expressions are  formed from operators and operands; any expression, including an assignment or a function call, can be a  statement. Pointers provide for machine-independent address arithmetic.

A Tutorial Introduction

Let us begin with a quick introduction in C. Our aim is to show the essential elements of the language in real  programs, but without getting bogged down in details, rules, and exceptions. At this point, we are not trying to be  complete or even precise (save that the examples are meant to be correct). We want to get you as quickly as possible to the point where you can write useful programs, and to do that we have to concentrate on the basics: variables and constants, arithmetic, control flow, functions, and the rudiments of input and output. We are intentionally leaving out of this chapter features of C that are important for writing bigger programs. These include pointers, structures, most of C’s rich set of operators, several control-flow statements, and the standard library. This approach and its drawbacks. Most notable is that the complete story on any particular feature is not found here, and the tutorial, by being brief, may also be misleading. And because the examples do not use the full power of C, they are not as concise and elegant as they might be. We have tried to minimize these effects, but be warned. Another drawback is that later chapters will necessarily repeat some of this chapter. We hope that the repetition will help you more than it annoys.

Getting Started

The only way to learn a new programming language is by writing programs in it. The first program to write is the  same for all languages:
Print the words
hello, world
This is a big hurdle; to leap over it you have to be able to create the program text somewhere, compile it  successfully, load it, run it, and find out where your output went. With these mechanical details mastered, everything else is comparatively easy.

…..

The C programming language

Télécharger aussi :

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *