C: A Reference Manual

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"

This best-selling, authoritative reference manual provides a complete description of the C language, the run-time libraries, and a style of C programming that empha_sizes correctness, portability, and maintainability. Describing the C language more clearly and in more detail than any other book, authors Samuel P. Harbison and Guy L. Steele Jr. provide in a single manual: Standard C (1999) - the new revison of the C Standard supports complex and Boolean types, variable length arrays, precise floating-point programming, and new libraries for portability and internationalization. Standard C (1989)- the version of C used by most of today's programmers. Traditional C-common practice before 1990, with millions of lines of code in use every day. C++ compatible C-code that can be used as C or C++. The complete C run-time libraries for all C versions. C: A Reference Manual is the only book that describes all the details of C-past and present. It is the single must-have reference for all C programmers and implementors. Thoroughly revised and updated, the expanded Fifth Edition includes a complete description of the latest C Standard, ISO/IEC 9899:1999, with its powerful language extensions and new libraries. New! Visit the Web site. www.CAReferenceManual.com contains source code for the longer examples in the book, expanded discussions on language issues, the latest ISO/IEC language corrigenda, and links to other C resources.

Author(s): Samuel P. Harbison III and Guy L. Steele Jr.
Edition: 5th
Publisher: Prentice Hall
Year: 2002

Language: English
Commentary: Added Bookmarks to PDF
Pages: 532

Ch 1- 3......Page 5
Ch 4 -7......Page 6
Ch 7 - 11......Page 7
Ch 11 - 15......Page 8
Ch 15 - 18......Page 9
Ch 19 - 24......Page 10
Ch 25 - Appendix C......Page 11
List of Tables......Page 12
Preface......Page 14
1.1 The Evolution of C......Page 17
1.2 Which Dialect of C Should You Use?......Page 20
1.3 An Overview of C Programming......Page 21
1.4 Conformance......Page 22
1.5 Syntax Notation......Page 23
2.1 Character Set......Page 24
2.2 Comments......Page 31
2.4 Operators and Separators......Page 33
2.5 Identifiers......Page 34
2.6 Keywords......Page 36
2.7 Constants......Page 37
2.8 C++ Compatibility......Page 51
2.9 On Character Sets, Repertoires, and Encodings......Page 52
2.10 Exercises......Page 54
3.1 Preprocessor Commands......Page 56
3.2 Preprocessor Lexical Conventions......Page 57
3.3 Definition and Replacement......Page 59
3.4 File Inclusion......Page 72
3.5 Conditional Compilation......Page 74
3.6 Explicit Line Numbering......Page 79
3.7 Pragma Directive......Page 80
3.8 Error Directive......Page 82
3.9 C++ Compatibility......Page 83
3.10 Exercises......Page 84
4 Declarations......Page 85
4.1 Organization of Declarations......Page 86
4.2 Terminology......Page 87
4.3 Storage Class and Function Specifiers......Page 95
4.4 Type Specifiers and Qualifiers......Page 98
4.5 Declarators......Page 107
4.6 Initializers......Page 115
4.8 External Names......Page 125
4.9 C++ Compatibility......Page 128
4.10 Exercises......Page 131
5 Types......Page 134
5.1 Integer Types......Page 135
5.2 Floating-Point Types......Page 143
5.3 Pointer Types......Page 147
5.4 Array Types......Page 151
5.5 Enumemted Types......Page 156
5.6 Structure Types......Page 159
5.7 Union Types......Page 171
5.8 Function Types......Page 176
5.10 Typedef Names......Page 179
5.1I Type Compatibility......Page 183
5.12 Type Names and Abstract Declarators......Page 187
5.13 C++ Compatibility......Page 189
5.14 Exercises......Page 190
6.1 Representations......Page 192
6.2 Conversions......Page 199
6.3 The Usual Conversions......Page 205
6.4 C++ Compatibility......Page 211
6.5 Exercises......Page 212
7.1 Objects, Lvalues. and Designators......Page 213
7.2 Expressions and Precedence......Page 214
7.3 Primary Expressions......Page 217
7.4 Postfix Expressions......Page 220
7.5 Unary Expressions......Page 229
7.6 Binary Operator Expressions......Page 237
7.7 Logical Operator Expressions......Page 252
7.8 Conditional Expressions......Page 254
7.9 Assignment Expressions......Page 256
7.10 Sequential Expressions......Page 259
7.11 Constant Expressions......Page 260
7.12 Order of Evaluation......Page 263
7.13 Discarded Values......Page 265
7.14 Optimization of Memory Accesses......Page 266
7.15 C++ Compatibility......Page 267
7.16 Exercises......Page 268
8 Statements......Page 269
8.2 Expression Statements......Page 270
8.3 Labeled Statements......Page 271
8.4 Compound Statements......Page 272
8.5 Conditional Statements......Page 274
8.6 Iterative Statements......Page 276
8.7 Switch Statements......Page 284
8.8 Break and Continue Statements......Page 287
8.9 Return Statements......Page 289
8.10 Goto Statements......Page 290
8.11 Null Statments......Page 291
8.13 Exercises......Page 292
9 Functions......Page 294
9.1 Function Definitions......Page 295
9.2 Function Prototypes......Page 298
9.3 Formal Parameter Declarations......Page 304
9.4 Adjustments to Parameter Types......Page 307
9.5 Parameter-Passing Conventions......Page 308
9.6 Agreement of Parameters......Page 309
9.7 Function Return Types......Page 310
9.8 Agreement of Return Types......Page 311
9.9 The Main Program......Page 312
9.10 Inline Function......Page 313
9.11 C++ Compatibility......Page 315
9.12 Exercises......Page 316
10 Introduction to the Libraries......Page 319
10.1 Standard C Facilities......Page 320
10.2 C++ Compatibility......Page 321
10.3 Library Headers and Names......Page 324
11.1 Null, ptrdiff_t, size_t, offsetof......Page 333
11.2 EDOM, ERANGE, EILSEQ, errno, strerror, perror......Page 335
11.4 va_list, va_start, va_arg, va_end......Page 337
11.5 Standard C Operator Macros......Page 341
12 Character Processing......Page 342
12.1 isalnum, isalpha, iscntrl, iswalnum, iswalpha, iswcntrl......Page 343
12.3 isdigit, isodigit, isxdigit, iswdigit, iswxdigit......Page 345
12.4 isgraph, isprint, ispunct, iswgraph, iswprint, iswpunct......Page 346
12.5 islower, isupper, iswlower, iswupper......Page 347
12.7 toascii......Page 348
12.9 tolower, toupper, towlower, towupper......Page 349
12.10 wctype_t, wctype, iswctype......Page 350
12.11 wctrans_t, wctrans......Page 351
13 String Processing......Page 353
13.1 strcat, strncat, wcscat, wcsncat......Page 354
13.2 strcmp, strncmp, wcscmp, wcsncmp......Page 355
13.3 strcpy, strncpy, wcscpy, wcsncpy......Page 356
13.5 strchr, strrchr, wcschr, wcsrchr......Page 357
13.6 strspn, strcspn, strpbrk, strrpbrk, wcsspn, wcscspn, wcspbrk......Page 358
13.7 strstr, strtok, wcsstr, wcstok......Page 360
13.8 strtod, strtof, strto1d, strto1, strtoll, strtou1, strtoull......Page 361
13.10 strcol!, strxfrm, wcscoll, wcsxfrm......Page 362
14.1 memchr, wmemchr......Page 364
14.2 memcmp, wmemcmp......Page 365
14.3 memcpy, memccpy, memmove, wmemcpy, wmemmove......Page 366
14.4 memset, wmemset......Page 367
15 Input/Output Facilities......Page 368
15.1 FILE, EOF, wchar_t, winU, WEOF......Page 370
15.2 fopen, fclose, fflush, freopen, fwide......Page 371
15.3 setbuf, setvbuf......Page 375
15.4 stdin, stdout, stderr......Page 376
15.5 fseek, ftell, rewind, fgetpos, fsetpos......Page 377
15.6 fgetc. fgetwc, getc, getwc, getchar, getwchar, ungetc, ungetwc......Page 379
15.7 fgets, fgetws, gets......Page 381
15.8 fscanf, fwscanf, scanf, wscanf, sscanf, swscanf......Page 382
15.9 fputc, fputwc, putc, putwc, putchar, putwchar......Page 390
15.10 fputs, fputws, puts......Page 391
15.11 fprintf, printf, sprintf, snprintf, fwprintf, wprintf, swprintf......Page 392
15.12 vfprintf, vfwprintf, vprintf, vwprintf, vsprintf, vswprintf, vfseanf, vfwscanf, vscanf, vwscanf, vsscanf, vswscanf......Page 406
15.13 fread, fwrite......Page 407
15.15 remove, rename......Page 409
15.16 tmpfile, tmpnam, mktemp......Page 410
16.1 malloc, calloc, mlalloc, clalloc, free, cfree......Page 411
16.2 rand, srand, RAND_MAX......Page 414
16.2 atof, atoi, atol, atoll......Page 415
16.4 strtod, strtof, strtold, strtol, strtoll, strtoul, strtoull......Page 416
16.5 abort, atexit, exit, _Exit, EXIT_FAILURE, EXIT_SUCCESS......Page 418
16.6 getenv......Page 419
16.7 system......Page 420
16.8 bsearch, qsort......Page 421
16.9 abs, labs, llabs, div, ldiv, lldiv......Page 423
16.10 mblen, mbtowc, wctomb......Page 424
16.11 mbstowcs, wcstombs......Page 426
17 Mathematical Functions......Page 429
17.2 fabs......Page 430
17.3 ceil, floor, lriot, llrint, lround, llround, nearbyint, round, rint, trunc......Page 431
17.4 fmod, remainder, remquo......Page 432
17.5 frexp, ldexp, modf, scalbn......Page 433
17.6 exp, exp2, expm1, ilogb, log, log10, log1p, log2, logb......Page 434
17.8 rand, srand, RAND_MAX......Page 436
17.9 cos, sin, tan, cosh, sinh, tanh......Page 437
17.10 acos, asio, atan, atan2, acosh, asinh, atanh......Page 438
17.12 Type-Generic Macros......Page 439
17.13 erf, erfc, lgamma, tgamma......Page 443
17.14 fpclassify, isfinite, isinf. isnan, isnormal, signbit......Page 444
17.15 copysign, nan, nextafter, nexttoward......Page 445
17.16 isgreater, isgreaterequal, isless, islessequal, islessgreater, isunordered......Page 446
18.1 clock, clock_t, CLOCKS_PER_SEC, times......Page 447
18.3 asctime, ctime......Page 449
18.4 gmtime, localtime, mktime......Page 450
18.5 difftime......Page 451
19.1 assert, NDEBUG......Page 456
19.4 setjmp,longjmp,jmp_buf......Page 457
19.6 signal, raise, gsignal, ssignal, psignal......Page 459
19.7 sleep, alarm......Page 461
20.1 setlocale......Page 463
20.2 localeconv......Page 465
21.1 General Rules......Page 469
21.2 Exact-Size Integer Types......Page 472
21.3 Least-Size Types of a Minimum Width......Page 473
21.4 Fast Types of a Minimum Width......Page 474
21.5 Pointer-Size and Maximum-Size Integer Types......Page 475
21.7 imaxabs, imaxdiv, imaxdiv_t......Page 476
21.9 wcstoimax, wcstoumax......Page 477
22.1 Overview......Page 479
22.2 Floating-Point Environment......Page 480
22.3 Floating-Point Exceptions......Page 481
22.4 Floating-Point Rounding Modes......Page 483
23.1 Complex Library Conventions......Page 484
23.3 CX_LIMITED_RANGE......Page 485
23.4 cacos, casin, catan, ccos, csin, ctan......Page 486
23.5 cacosh, casinh, catanh, ccosh, csinh, ctanh......Page 487
23.6 cexp, clog, cabs, cpow, csqrt......Page 488
23.7 carg, cimag, creal, conj, cproj......Page 489
24.1 Basic Types and Macros......Page 490
24.2 Conversions Between Wide and Multibyte Characters......Page 491
24.3 Conversions Between Wide and Multibyte Strings......Page 492
24.6 String Functions......Page 494
24.8 Wide-Character Classification and Mapping Functions......Page 495
A The ASCII Character Set......Page 497
B Syntax......Page 498
C Answers to Exercises......Page 512
Index......Page 520