C Programming_ The Tutorial - Thomas Gabriel
CONTENTS
PART I C-PROGRAMMING
CHAPTER I
OVERVIEW
I.1 Introduction
I.2 The very first step
I.3 Variables
I.4 Comments
I.5 Operations
I.6 Control flow
I.7 Functions
I.8 Macros
I.9 Line continuation
I.10 Portability
CHAPTER II
BASIC TYPES AND VARIABLES
II.1 Introduction
II.2 Numeral systems
II.3 Data representation
II.4 Literals
II.5 Variables
II.6 Basic types
II.7 Types of constants
II.8 Type qualifiers
II.9 Aliasing types
II.10 Compatible types
II.11 Conversions
II.12 Exercises
CHAPTER III
ARRAYS, POINTERS AND STRINGS
III.1 Introduction
III.2 Arrays
III.3 Pointers
III.4 Strings
III.5 Arrays are not pointers
III.6 malloc(), realloc() and calloc()
III.7 Emulating multidimensional arrays with pointers
III.8 Array of pointers, pointer to array and pointer to pointer
III.9 Variable-length arrays and variably modified types
III.10 Creating types from array and pointer types
III.11 Qualified pointer types
III.12 Compatible types
III.13 Data alignment
III.14 Conversions
III.15 Exercises
CHAPTER IV
OPERATORS
IV .1 Introduction
IV .2 Arithmetic operators
IV .3 Relational operators
IV .4 Equality operators
IV .5 Logical operators
IV .6 Bitwise operators
IV .7 Address and dereferencing operators
IV .8 Increment and decrement operators
IV .9 lvalue
IV .10 Assignment operators
IV .11 Ternary conditional operator
IV .12 Comma operator
IV .13 Operator precedence
IV .14 Type conversion
IV .15 Constant expressions
IV .16 Exercises
CHAPTER V
CONTROL FLOW
V .1 Introduction
V .2 Statements
V .3 if statement
V .4 continue
V .5 break
V .6 goto
V .7 Nested loops
V .8 Exercises
CHAPTER VI
USER-DEFINED TYPES
VI.1 Introduction
VI.2 Enumerations
VI.3 Structures
VI.4 unions
VI.5 Alignments
VI.6 Compatible types
VI.7 Conversions
VI.8 Exercises
CHAPTER VII
FUNCTIONS
VII.1 Introduction
VII.2 Definition
VII.3 Function calls
VII.4 Return statement, part1
VII.5 Function declarations
VII.6 Scope of identifiers
VII.7 Storage duration
VII.8 Compound literals
VII.9 Object initializations
VII.10 Return statement, part2
VII.11 Default argument promotions
VII.12 Function type compatibility
VII.13 Conversions
VII.14 Call-by-value
VII.15 Call-by-reference
VII.16 Passing arrays
VII.17 Variable-length arrays and variably modified types
VII.18 Type qualifiers
VII.19 Recursive functions
VII.20 Pointer to function
VII.21 Understanding C declarations
VII.22 Pointers to functions as structure members
VII.23 functions and void *
VII.24 Parameters declared as void *
VII.25 Side effects VII.26 Compound statements
VII.27 Inline functions and macros
VII.28 Variable number of parameters
VII.29 Some useful macros
VII.30 main() function
VII.31 exit() function
VII.32 Exercises
CHAPTER VIII
C MODULES
VIII.1 Introduction
VIII.2 Overview
VIII.3 Writing Source Files
VIII.4 Header Files
VIII.5 Separate Compilation
VIII.6 Declaration, definition, initialization and prototype
VIII.7 Scope of user-defined types
VIII.8 Default argument promotions
VIII.9 Compatible structure, union and enumerated types
VIII.10 An example
VIII.11 Encapsulation
VIII.12 Exercise
CHAPTER IX
INTERNATIONALIZATION
IX.1 Locales
IX.2 Categories
IX.3 setlocale
IX.4 localeconv()
IX.5 Character encodings
IX.6 Terminal settings
IX.7 strcoll() and strxfm()
IX.8 Conversion functions
IX.9 Functions manipulating wide characters
CHAPTER X
INPUT/OUTPUT X.1 Introduction
X.2 Files
X.3 closing a file
X.4 Reading a file
X.5 Writing to a file
X.6 Position indicator
X.7 Managing errors
X.8 Buffers
X.9 freopen()
X.10 Standard input, standard input, standard error
X.11 Removing a file
X.12 Renaming a file
X.13 Temporary files
X.14 Wide and Multibyte I/O functions
X.15 Exercises
CHAPTER XI
STANDARD C LIBRARY
XI.1 Introduction
XI.2 <assert.h>
XI.3 <ctype.h>: character handling functions
XI.4 <errno.h>
XI.5 <math.h>
XI.6 <stdarg.h>
XI.7 <stdbool.h>
XI.8 <stddef.h>
XI.9 <stdio.h>
XI.10 <stdint.h>
XI.11 <stdlib.h>
XI.12 <string.h>
XI.13 <time.h>
XI.14 <signal.h>
XI.15 <setjmp.h>
XI.16 <wctype.h>: wide character handling functions
XI.17 <wchar.h>
CHAPTER XII
C11
XII.1 Introduction
XII.2 Generic selection
XII.3 Exclusive open mode
XII.4 Anonymous unions and structures
XII.5 Static assertion
XII.6 No-return functions
XII.7 Complex XII.8 Alignment
XII.9 Bounds-checking functions PART II TOOLS
CHAPTER XIII
COMPILING C PROGRAMS
XIII.1 Introduction XIII.2 Compilation Phases
XIII.3 Preprocessing
XIII.4 Lexical analysis
XIII.5 Syntax analysis
XIII.6 Semantic analysis
XIII.7 Assembly code
XIII.8 Assembly
XIII.9 Linking
XIII.10 Compilers and Interpreters
XIII.11 Compiler Driver
XIII.12 Compiling C Programs
XIII.13 GNU gcc
XIII.14 Writing Source Files
XIII.15 Header Files
XIII.16 Separate compilation
XIII.17 Warning Messages
XIII.18 Libraries
CHAPTER XIV
MAKEFILE
XIV .1 Introduction
XIV .2 Invocation
XIV .3 Makefile
XIV .4 Rules
XIV .5 Dependency graph
XIV .6 Macros
XIV .7 Implicit rules
XIV .8 Controlling make behavior
XIV .9 Recursive make
XIV .10 Using multiple rules for one target
XIV .11 Multiple targets in the same rule
XIV .12 Continuation line
XIV .13 Compiling C programs with make
XIV .14 Dependency graph
CHAPTER XV
PROGRAMMING TOOLS
XV .1 Introduction
XV .2 Lint and splint
XV .3 Time
XV .4 Prof and gprof
XV .5 GDB
XV .6 Maintaining file versions