C in a Nutshell

Book description

Learning a language--any language--involves a process wherein you learn to rely less and less on instruction and more increasingly on the aspects of the language you've mastered. Whether you're learning French, Java, or C, at some point you'll set aside the tutorial and attempt to converse on your own. It's not necessary to know every subtle facet of French in order to speak it well, especially if there's a good dictionary available. Likewise, C programmers don't need to memorize every detail of C in order to write good programs. What they need instead is a reliable, comprehensive reference that they can keep nearby. C in a Nutshell is that reference.

This long-awaited book is a complete reference to the C programming language and C runtime library. Its purpose is to serve as a convenient, reliable companion in your day-to-day work as a C programmer. C in a Nutshell covers virtually everything you need to program in C, describing all the elements of the language and illustrating their use with numerous examples.

The book is divided into three distinct parts. The first part is a fast-paced description, reminiscent of the classic Kernighan & Ritchie text on which many C programmers cut their teeth. It focuses specifically on the C language and preprocessor directives, including extensions introduced to the ANSI standard in 1999. These topics and others are covered:

  • Numeric constants
  • Implicit and explicit type conversions
  • Expressions and operators
  • Functions
  • Fixed-length and variable-length arrays
  • Pointers
  • Dynamic memory management
  • Input and output

The second part of the book is a comprehensive reference to the C runtime library; it includes an overview of the contents of the standard headers and a description of each standard library function. Part III provides the necessary knowledge of the C programmer's basic tools: the compiler, the make utility, and the debugger. The tools described here are those in the GNU software collection.

C in a Nutshell is the perfect companion to K&R, and destined to be the most reached-for reference on your desk.

Publisher resources

View/Submit Errata

Table of contents

  1. C in a Nutshell
  2. Preface
    1. How This Book Is Organized
      1. Part I
      2. Part II
      3. Part III
    2. Further Reading
    3. Conventions Used in This Book
    4. Using Code Examples
    5. Safari® Enabled
    6. Your Questions and Comments
    7. Acknowledgments
      1. Peter
      2. Tony
  3. I. Language
    1. 1. Language Basics
      1. 1.1. Characteristics of C
      2. 1.2. The Structure of C Programs
      3. 1.3. Source Files
      4. 1.4. Comments
      5. 1.5. Character Sets
        1. 1.5.1. Wide Characters and Multibyte Characters
        2. 1.5.2. Universal Character Names
        3. 1.5.3. Digraphs and Trigraphs
      6. 1.6. Identifiers
        1. 1.6.1. Identifier Name Spaces
        2. 1.6.2. Identifier Scope
      7. 1.7. How the C Compiler Works
        1. 1.7.1. The C Compiler’s Translation Phases
        2. 1.7.2. Tokens
    2. 2. Types
      1. 2.1. Typology
      2. 2.2. Integer Types
        1. 2.2.1. Integer Types with Exact Width (C99)
      3. 2.3. Floating-Point Types
      4. 2.4. Complex Floating-Point Types (C99)
      5. 2.5. Enumerated Types
      6. 2.6. The Type void
        1. 2.6.1. void in Function Declarations
        2. 2.6.2. Expressions of Type void
        3. 2.6.3. Pointers to void
    3. 3. Literals
      1. 3.1. Integer Constants
      2. 3.2. Floating-Point Constants
        1. 3.2.1. Decimal Floating-Point Constants
        2. 3.2.2. Hexadecimal Floating-Point Constants (C99)
      3. 3.3. Character Constants
        1. 3.3.1. The Type of Character Constants
        2. 3.3.2. Escape Sequences
      4. 3.4. String Literals
    4. 4. Type Conversions
      1. 4.1. Conversion of Arithmetic Types
        1. 4.1.1. Hierarchy of Types
        2. 4.1.2. Integer Promotion
        3. 4.1.3. Usual Arithmetic Conversions
        4. 4.1.4. Other Implicit Type Conversions
        5. 4.1.5. The Results of Arithmetic Type Conversions
          1. 4.1.5.1. Conversions to _Bool
          2. 4.1.5.2. Conversions to unsigned integer types other than _Bool
          3. 4.1.5.3. Conversions to signed integer types
          4. 4.1.5.4. Conversions to real floating-point types
          5. 4.1.5.5. Conversions to complex floating-point types
      2. 4.2. Conversion of Nonarithmetic Types
        1. 4.2.1. Array and Function Designators
        2. 4.2.2. Explicit Pointer Conversions
          1. 4.2.2.1. Object pointers
          2. 4.2.2.2. Function pointers
        3. 4.2.3. Implicit Pointer Conversions
          1. 4.2.3.1. Pointers to void
          2. 4.2.3.2. Pointers to qualified object types
          3. 4.2.3.3. Null pointer constants
        4. 4.2.4. Conversions Between Pointer and Integer Types
    5. 5. Expressions and Operators
      1. 5.1. How Expressions Are Evaluated
        1. 5.1.1. Lvalues
        2. 5.1.2. Side Effects and Sequence Points
        3. 5.1.3. Operator Precedence and Associativity
      2. 5.2. Operators in Detail
        1. 5.2.1. Arithmetic Operators
          1. 5.2.1.1. Standard arithmetic
          2. 5.2.1.2. Pointer arithmetic
        2. 5.2.2. Assignment Operators
          1. 5.2.2.1. Simple assignment
          2. 5.2.2.2. Compound assignments
        3. 5.2.3. Increment and Decrement Operators
        4. 5.2.4. Comparative Operators
        5. 5.2.5. Logical Operators
        6. 5.2.6. Bitwise Operators
          1. 5.2.6.1. Boolean bitwise operators
          2. 5.2.6.2. Shift operators
        7. 5.2.7. Memory Addressing Operators
          1. 5.2.7.1. The & and * operators
          2. 5.2.7.2. Elements of arrays
          3. 5.2.7.3. Members of structures and unions
        8. 5.2.8. Other Operators
          1. 5.2.8.1. Function calls
          2. 5.2.8.2. Compound literals
          3. 5.2.8.3. The sizeof operator
          4. 5.2.8.4. The conditional operator
          5. 5.2.8.5. The comma operator
      3. 5.3. Constant Expressions
        1. 5.3.1. Integer Constant Expressions
        2. 5.3.2. Other Constant Expressions
    6. 6. Statements
      1. 6.1. Expression Statements
      2. 6.2. Block Statements
      3. 6.3. Loops
        1. 6.3.1. while Statements
        2. 6.3.2. for Statements
        3. 6.3.3. do...while Statements
        4. 6.3.4. Nested Loops
      4. 6.4. Selection Statements
        1. 6.4.1. if Statements
        2. 6.4.2. switch Statements
      5. 6.5. Unconditional Jumps
        1. 6.5.1. The break Statement
        2. 6.5.2. The continue Statement
        3. 6.5.3. The goto Statement
        4. 6.5.4. The return Statement
    7. 7. Functions
      1. 7.1. Function Definitions
        1. 7.1.1. Functions and Storage Class Specifiers
        2. 7.1.2. K&R-Style Function Definitions
        3. 7.1.3. Function Parameters
        4. 7.1.4. Arrays as Function Parameters
        5. 7.1.5. The main() Function
      2. 7.2. Function Declarations
        1. 7.2.1. Declaring Optional Parameters
        2. 7.2.2. Declaring Variable-Length Array Parameters
      3. 7.3. How Functions Are Executed
      4. 7.4. Pointers as Arguments and Return Values
      5. 7.5. Inline Functions
      6. 7.6. Recursive Functions
      7. 7.7. Variable Numbers of Arguments
    8. 8. Arrays
      1. 8.1. Defining Arrays
        1. 8.1.1. Fixed-Length Arrays
        2. 8.1.2. Variable-Length Arrays
      2. 8.2. Accessing Array Elements
      3. 8.3. Initializing Arrays
        1. 8.3.1. Writing Initialization Lists
        2. 8.3.2. Initializing Specific Elements
      4. 8.4. Strings
      5. 8.5. Multidimensional Arrays
        1. 8.5.1. Matrices
        2. 8.5.2. Declaring Multidimensional Arrays
        3. 8.5.3. Initializing Multidimensional Arrays
      6. 8.6. Arrays as Arguments of Functions
    9. 9. Pointers
      1. 9.1. Declaring Pointers
        1. 9.1.1. Null Pointers
        2. 9.1.2. void Pointers
        3. 9.1.3. Initializing Pointers
      2. 9.2. Operations with Pointers
        1. 9.2.1. Using Pointers to Read and Modify Objects
        2. 9.2.2. Modifying and Comparing Pointers
      3. 9.3. Pointers and Type Qualifiers
        1. 9.3.1. Constant Pointers and Pointers to Constant Objects
        2. 9.3.2. Restricted Pointers
      4. 9.4. Pointers to Arrays and Arrays of Pointers
        1. 9.4.1. Array Pointers
        2. 9.4.2. Pointer Arrays
      5. 9.5. Pointers to Functions
    10. 10. Structures and Unions and Bit-Fields
      1. 10.1. Structures
        1. 10.1.1. Defining Structure Types
        2. 10.1.2. Structure Objects and typedef Names
        3. 10.1.3. Incomplete Structure Types
        4. 10.1.4. Accessing Structure Members
        5. 10.1.5. Initializing Structures
        6. 10.1.6. Initializing Specific Members
        7. 10.1.7. Structure Members in Memory
        8. 10.1.8. Flexible Structure Members
        9. 10.1.9. Pointers as Structure Members
      2. 10.2. Unions
        1. 10.2.1. Defining Union Types
        2. 10.2.2. Initializing Unions
      3. 10.3. Bit-Fields
    11. 11. Declarations
      1. 11.1. General Syntax
        1. 11.1.1. Examples
        2. 11.1.2. Storage Class Specifiers
        3. 11.1.3. Type Qualifiers
        4. 11.1.4. Declarations and Definitions
        5. 11.1.5. Complex Declarators
      2. 11.2. Type Names
      3. 11.3. typedef Declarations
      4. 11.4. Linkage of Identifiers
        1. 11.4.1. External Linkage
        2. 11.4.2. Internal Linkage
        3. 11.4.3. No Linkage
      5. 11.5. Storage Duration of Objects
        1. 11.5.1. Static Storage Duration
        2. 11.5.2. Automatic Storage Duration
      6. 11.6. Initialization
        1. 11.6.1. Implicit Initialization
        2. 11.6.2. Explicit Initialization
    12. 12. Dynamic Memory Management
      1. 12.1. Allocating Memory Dynamically
      2. 12.2. Characteristics of Allocated Memory
      3. 12.3. Resizing and Releasing Memory
      4. 12.4. An All-Purpose Binary Tree
      5. 12.5. Characteristics
      6. 12.6. Implementation
        1. 12.6.1. Generating an Empty Tree
        2. 12.6.2. Inserting New Data
        3. 12.6.3. Finding Data in the Tree
        4. 12.6.4. Removing Data from the Tree
        5. 12.6.5. Traversing a Tree
        6. 12.6.6. A Sample Application
    13. 13. Input and Output
      1. 13.1. Streams
        1. 13.1.1. Text Streams
        2. 13.1.2. Binary Streams
      2. 13.2. Files
        1. 13.2.1. File Position
        2. 13.2.2. Buffers
        3. 13.2.3. The Standard Streams
      3. 13.3. Opening and Closing Files
        1. 13.3.1. Opening a File
        2. 13.3.2. Access Modes
        3. 13.3.3. Closing a File
      4. 13.4. Reading and Writing
        1. 13.4.1. Byte-Oriented and Wide-Oriented Streams
        2. 13.4.2. Error Handling
          1. 13.4.2.1. Return values and status flags
          2. 13.4.2.2. The error variable errno
        3. 13.4.3. Unformatted I/O
          1. 13.4.3.1. Reading characters
          2. 13.4.3.2. Putting a character back
          3. 13.4.3.3. Writing characters
          4. 13.4.3.4. Reading strings
          5. 13.4.3.5. Writing strings
          6. 13.4.3.6. Reading and writing blocks
        4. 13.4.4. Formatted Output
          1. 13.4.4.1. The printf() function family
          2. 13.4.4.2. The format string
          3. 13.4.4.3. Field widths
          4. 13.4.4.4. Printing characters and strings
          5. 13.4.4.5. Printing integers
          6. 13.4.4.6. Printing floating-point numbers
        5. 13.4.5. Formatted Input
          1. 13.4.5.1. The scanf() function family
          2. 13.4.5.2. The format string
          3. 13.4.5.3. Field widths
          4. 13.4.5.4. Reading characters and strings
          5. 13.4.5.5. Reading integers
          6. 13.4.5.6. Reading floating-point numbers
      5. 13.5. Random File Access
        1. 13.5.1. Obtaining the Current File Position
        2. 13.5.2. Setting the File Access Position
    14. 14. Preprocessing Directives
      1. 14.1. Inserting the Contents of Header Files
        1. 14.1.1. How the Preprocessor Finds Header Files
        2. 14.1.2. Nested #include Directives
      2. 14.2. Defining and Using Macros
        1. 14.2.1. Macros Without Parameters
        2. 14.2.2. Macros with Parameters
          1. 14.2.2.1. Variable numbers of arguments
          2. 14.2.2.2. The stringify operator
          3. 14.2.2.3. The token-pasting operator
        3. 14.2.3. Using Macros Within Macros
        4. 14.2.4. Macro Scope and Redefinition
      3. 14.3. Conditional Compiling
        1. 14.3.1. The #if and #elif Directives
        2. 14.3.2. The defined Operator
        3. 14.3.3. The #ifdef and #ifndef Directives
      4. 14.4. Defining Line Numbers
      5. 14.5. Generating Error Messages
      6. 14.6. The #pragma Directive
      7. 14.7. The _Pragma Operator
      8. 14.8. Predefined Macros
  4. II. Standard Library
    1. 15. The Standard Headers
      1. 15.1. Using the Standard Headers
        1. 15.1.1. Execution Environments
        2. 15.1.2. Function and Macro Calls
        3. 15.1.3. Reserved Identifiers
      2. 15.2. Contents of the Standard Headers
        1. 15.2.1. assert.h
        2. 15.2.2. complex.h
        3. 15.2.3. ctype.h
        4. 15.2.4. errno.h
        5. 15.2.5. fenv.h
          1. 15.2.5.1. Macro and type definitions for the floating-point environment
          2. 15.2.5.2. Macro and type definitions for floating-point exceptions
          3. 15.2.5.3. Macro definitions for rounding modes
        6. 15.2.6. float.h
          1. 15.2.6.1. Normalized representation of floating-point numbers
          2. 15.2.6.2. Rounding mode and evaluation method
          3. 15.2.6.3. Precision and value range
        7. 15.2.7. inttypes.h
          1. 15.2.7.1. Types
          2. 15.2.7.2. Functions
          3. 15.2.7.3. Macros
        8. 15.2.8. iso646.h
        9. 15.2.9. limits.h
        10. 15.2.10. locale.h
        11. 15.2.11. math.h
          1. 15.2.11.1. The types float_t and double_t
          2. 15.2.11.2. Classification macros
          3. 15.2.11.3. Other macros in math.h
        12. 15.2.12. setjmp.h
        13. 15.2.13. signal.h
        14. 15.2.14. stdarg.h
        15. 15.2.15. stdbool.h
        16. 15.2.16. stddef.h
        17. 15.2.17. stdint.h
          1. 15.2.17.1. Value ranges of the integer types with specific widths
          2. 15.2.17.2. Value ranges of other integer types
          3. 15.2.17.3. Macros for integer constants
        18. 15.2.18. stdio.h
        19. 15.2.19. stdlib.h
        20. 15.2.20. string.h
        21. 15.2.21. tgmath.h
        22. 15.2.22. time.h
        23. 15.2.23. wchar.h
        24. 15.2.24. wctype.h
    2. 16. Functions at a Glance
      1. 16.1. Input and Output
      2. 16.2. Mathematical Functions
        1. 16.2.1. Mathematical Functions for Integer Types
        2. 16.2.2. Floating-Point Functions
        3. 16.2.3. Function-like Macros
          1. 16.2.3.1. Type-generic macros
          2. 16.2.3.2. Categories of floating-point values
          3. 16.2.3.3. Comparison macros
        4. 16.2.4. Pragmas for Arithmetic Operations
        5. 16.2.5. The Floating-Point Environment
          1. 16.2.5.1. Accessing status flags
          2. 16.2.5.2. Rounding modes
          3. 16.2.5.3. Saving the whole floating-point environment
        6. 16.2.6. Error Handling
          1. 16.2.6.1. Domain errors
          2. 16.2.6.2. Range errors
      3. 16.3. Character Classification and Conversion
        1. 16.3.1. Character Classification
        2. 16.3.2. Case Mapping
      4. 16.4. String Processing
      5. 16.5. Multibyte Characters
      6. 16.6. Converting Between Numbers and Strings
      7. 16.7. Searching and Sorting
      8. 16.8. Memory Block Handling
      9. 16.9. Dynamic Memory Management
      10. 16.10. Date and Time
      11. 16.11. Process Control
        1. 16.11.1. Communication with the Operating System
        2. 16.11.2. Signals
      12. 16.12. Internationalization
      13. 16.13. Nonlocal Jumps
      14. 16.14. Debugging
      15. 16.15. Error Messages
    3. 17. Standard Library Functions
      1. _Exit C99
      2. abort
      3. abs
      4. acos
      5. acosh C99
      6. asctime
      7. asin
      8. asinh C99
      9. assert
      10. atan
      11. atan2
      12. atanh C99
      13. atexit
      14. atof
      15. atoi
      16. atol, atoll
      17. bsearch
      18. btowc
      19. cabs C99
      20. cacos C99
      21. cacosh C99
      22. calloc
      23. carg C99
      24. casin C99
      25. casinh C99
      26. catan C99
      27. catanh C99
      28. cbrt C99
      29. ccos C99
      30. ccosh C99
      31. ceil
      32. cexp C99
      33. cimag C99
      34. clearerr
      35. clock
      36. conj C99
      37. copysign C99
      38. cos
      39. cosh
      40. cpow C99
      41. cproj C99
      42. creal C99
      43. csin C99
      44. csinh C99
      45. csqrt C99
      46. ctan C99
      47. ctanh C99
      48. ctime
      49. difftime
      50. div
      51. erf C99
      52. erfc C99
      53. exit
      54. exp
      55. exp2 C99
      56. expm1 C99
      57. fabs
      58. fclose
      59. fdim C99
      60. feclearexcept C99
      61. fegetenv C99
      62. fegetexceptflag C99
      63. fegetround C99
      64. feholdexcept C99
      65. feof
      66. feraiseexcept C99
      67. ferror
      68. fesetenv C99
      69. fesetexceptflag C99
      70. fesetround C99
      71. fetestexcept C99
      72. feupdateenv C99
      73. fflush
      74. fgetc
      75. fgetpos
      76. fgets
      77. fgetwc
      78. fgetws
      79. floor
      80. fma C99
      81. fmax C99
      82. fmin C99
      83. fmod
      84. fopen
      85. fpclassify C99
      86. fprintf
      87. fputc
      88. fputs
      89. fputwc
      90. fputws
      91. fread
      92. free
      93. freopen
      94. frexp
      95. fscanf
      96. fseek
      97. fsetpos
      98. ftell
      99. fwide
      100. fwprintf
      101. fwscanf
      102. fwrite
      103. getc
      104. getchar
      105. getenv
      106. gets
      107. getwc
      108. getwchar
      109. gmtime
      110. hypot C99
      111. ilogb C99
      112. imaxabs C99
      113. imaxdiv C99
      114. isalnum
      115. isalpha
      116. isblank C99
      117. iscntrl
      118. isdigit
      119. isfinite C99
      120. isgraph
      121. isgreater, isgreaterequal C99
      122. isinf C99
      123. isless, islessequal, islessgreater C99
      124. islower
      125. isnan C99
      126. isnormal C99
      127. isprint
      128. ispunct
      129. isspace
      130. isunordered C99
      131. isupper
      132. iswalnum
      133. iswalpha
      134. iswblank C99
      135. iswcntrl
      136. iswctype
      137. iswdigit
      138. iswgraph
      139. iswlower
      140. iswprint
      141. iswpunct
      142. iswspace
      143. iswupper
      144. iswxdigit
      145. isxdigit
      146. labs
      147. ldexp
      148. ldiv
      149. llabs C99
      150. lldiv C99
      151. llrint
      152. llround
      153. localeconv
      154. localtime
      155. log
      156. log10
      157. log1p C99
      158. log2 C99
      159. logb C99
      160. longjmp
      161. lrint C99
      162. lround C99
      163. malloc
      164. mblen
      165. mbrlen
      166. mbrtowc C99
      167. mbsinit
      168. mbsrtowcs
      169. mbstowcs
      170. mbtowc
      171. memchr
      172. memcmp
      173. memcpy
      174. memmove
      175. memset
      176. mktime
      177. modf
      178. nearbyint C99
      179. nextafter C99
      180. nexttoward C99
      181. perror
      182. pow
      183. printf
      184. putc
      185. putchar
      186. puts
      187. putwc
      188. putwchar
      189. qsort
      190. raise
      191. rand
      192. realloc
      193. remainder C99
      194. remove
      195. remquo C99
      196. rename
      197. rewind
      198. rint C99
      199. round C99
      200. scalbln, scalbn C99
      201. scanf
      202. setbuf
      203. setjmp
      204. setlocale
      205. setvbuf
      206. signal
      207. signbit C99
      208. sin
      209. sinh
      210. snprintf
      211. sprintf
      212. sqrt
      213. srand
      214. sscanf
      215. strcat
      216. strchr
      217. strcmp
      218. strcoll
      219. strcpy
      220. strcspn
      221. strerror
      222. strftime
      223. strlen
      224. strncat
      225. strncmp
      226. strncpy
      227. strpbrk
      228. strrchr
      229. strspn
      230. strstr
      231. strtod, strtof, strtold
      232. strtoimax C99
      233. strtok
      234. strtol, strtoll
      235. strtoul, strtoull
      236. strtoumax C99
      237. strxfrm
      238. swprintf
      239. swscanf
      240. system
      241. tan
      242. tanh
      243. time
      244. tmpfile
      245. tmpnam
      246. tolower
      247. toupper
      248. towctrans
      249. towlower
      250. towupper
      251. trunc C99
      252. ungetc
      253. ungetwc
      254. va_arg, va_copy, va_end, va_start
      255. vfprintf, vprintf, vsnprintf, vsprintf
      256. vfscanf, vscanf, vsscanf
      257. vfwprintf, vswprintf, vwprintf
      258. vfwscanf, vswscanf, vwscanf
      259. wcrtomb
      260. wcscat
      261. wcschr
      262. wcscmp
      263. wcscoll
      264. wcscpy
      265. wcscspn
      266. wcsftime
      267. wcslen
      268. wcsncat
      269. wcsncmp
      270. wcsncpy
      271. wcspbrk
      272. wcsrchr
      273. wcsrtombs
      274. wcsspn
      275. wcsstr
      276. wcstod, wcstof, wcstold
      277. wcstoimax C99
      278. wcstok
      279. wcstol, wcstoll
      280. wcstold
      281. wcstoll
      282. wcstombs
      283. wcstoul, wcstoull
      284. wcstoumax C99
      285. wcsxfrm
      286. wctob
      287. wctomb
      288. wctrans
      289. wctype
      290. wmemchr
      291. wmemcmp
      292. wmemcpy
      293. wmemmove
      294. wmemset
      295. wprintf
      296. wscanf
  5. III. Basic Tools
    1. 18. Compiling with GCC
      1. 18.1. The GNU Compiler Collection
      2. 18.2. Obtaining and Installing GCC
      3. 18.3. Compiling C Programs with GCC
        1. 18.3.1. Step by Step
          1. 18.3.1.1. Preprocessing
          2. 18.3.1.2. Compiling
          3. 18.3.1.3. Assembling
          4. 18.3.1.4. Linking
          5. 18.3.1.5. All of the above
          6. 18.3.1.6. None of the above
        2. 18.3.2. Multiple Input Files
          1. 18.3.2.1. File types
          2. 18.3.2.2. Mixed input types
        3. 18.3.3. Dynamic Linking and Shared Object Files
        4. 18.3.4. Freestanding Programs
      4. 18.4. C Dialects
      5. 18.5. Compiler Warnings
      6. 18.6. Optimization
        1. 18.6.1. The -O Levels
        2. 18.6.2. The -f Flags
        3. 18.6.3. Floating-Point Optimization
        4. 18.6.4. Architecture-Specific Optimization
        5. 18.6.5. Why Not Optimize?
      7. 18.7. Debugging
      8. 18.8. Profiling
      9. 18.9. Option and Environment Variable Summary
        1. 18.9.1. Command-Line Options
        2. 18.9.2. Environment Variables
    2. 19. Using make to Build C Programs
      1. 19.1. Targets, Prerequisites, and Commands
      2. 19.2. The Makefile
      3. 19.3. Rules
        1. 19.3.1. The Command Script
        2. 19.3.2. Pattern Rules
        3. 19.3.3. Suffix Rules
        4. 19.3.4. Built-in Rules
        5. 19.3.5. Implicit Rule Chains
        6. 19.3.6. Double-Colon Rules
      4. 19.4. Comments
      5. 19.5. Variables
        1. 19.5.1. Assignment Operators
        2. 19.5.2. Variables and Whitespace
        3. 19.5.3. Target-Specific Variable Assignments
        4. 19.5.4. The Automatic Variables
        5. 19.5.5. Other Built-in Variables
        6. 19.5.6. Environment Variables
      6. 19.6. Phony Targets
      7. 19.7. Other Target Attributes
      8. 19.8. Macros
      9. 19.9. Functions
        1. 19.9.1. Built-in Functions
          1. 19.9.1.1. Text-processing functions
          2. 19.9.1.2. Filename-manipulation functions
          3. 19.9.1.3. Conditions and flow control functions
          4. 19.9.1.4. Operations on variables
          5. 19.9.1.5. System functions
        2. 19.9.2. User-Defined Functions
      10. 19.10. Directives
        1. 19.10.1. Conditionals
        2. 19.10.2. Includes
        3. 19.10.3. Other Directives
      11. 19.11. Running make
        1. 19.11.1. Generating Header Dependencies
        2. 19.11.2. Recursive make Commands
        3. 19.11.3. Command-Line Options
        4. 19.11.4. Special Targets Used as Runtime Options
        5. 19.11.5. GCC Options for Generating Makefile Rules
    3. 20. Debugging C Programs with GDB
      1. 20.1. Installing GDB
      2. 20.2. A Sample Debugging Session
        1. 20.2.1. Symbol Information
        2. 20.2.2. Finding a Bug
      3. 20.3. Starting GDB
        1. 20.3.1. Command-Line Arguments
        2. 20.3.2. Command-Line Options
          1. 20.3.2.1. Passing arguments to the program being debugged
          2. 20.3.2.2. Selecting files
          3. 20.3.2.3. Selecting the user interface
          4. 20.3.2.4. Executing command scripts
        3. 20.3.3. Initialization Files
      4. 20.4. Using GDB Commands
        1. 20.4.1. Command Completion
        2. 20.4.2. Displaying Help for Commands
        3. 20.4.3. Status Information
          1. 20.4.3.1. Status information on the program being debugged
          2. 20.4.3.2. Status information on the debugger
        4. 20.4.4. Running a Program in the Debugger
        5. 20.4.5. Displaying Source Code
        6. 20.4.6. Working with Breakpoints
          1. 20.4.6.1. Setting and displaying breakpoints
          2. 20.4.6.2. Deleting, disabling, and ignoring breakpoints
          3. 20.4.6.3. Conditional breakpoints
        7. 20.4.7. Resuming Execution After a Break
        8. 20.4.8. Analyzing the Stack
          1. 20.4.8.1. Displaying a call trace
          2. 20.4.8.2. Displaying and changing the current stack frame
          3. 20.4.8.3. Displaying arguments and local variables
        9. 20.4.9. Displaying Data
          1. 20.4.9.1. Displaying values of expressions
          2. 20.4.9.2. Output formats
          3. 20.4.9.3. Displaying memory blocks
        10. 20.4.10. Watchpoints: Observing Operations on Variables
        11. 20.4.11. Analyzing Core Files in GDB
  6. Index
  7. About the Authors
  8. Colophon
  9. Copyright

Product information

  • Title: C in a Nutshell
  • Author(s): Peter Prinz, Tony Crawford
  • Release date: December 2005
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596006976