C Tutorial/Language/Header Files

Материал из C\C++ эксперт
Перейти к: навигация, поиск

Common Headers

Header Purpose assert.h Defines the assert() macro ctype.h Character handling errno.h Error reporting float.h Defines implementation-dependent floating-point limits limits.h dependent limits locale.h Localization math.h math library setjmp.h Nonlocal jumps signal.h Signal handling stdarg.h Variable argument lists stddef.h Constants stdio.h I/O system stdlib.h Miscellaneous declarations string.h string functions time.h system time functions

From C: The Complete Reference, Fourth Edition by Herbert Schildt McGraw-Hill/Osborne 2000

Headers

  1. Each function in the C standard library has its associated header.
  2. The headers are included using #include.
  3. Header Including obtains the Declarations for the standard library functions.

1.17.Header Files 1.17.1. <A href="/Tutorial/C/0020__Language/Includeheaderfile.htm">Include header file</a> 1.17.2. <A href="/Tutorial/C/0020__Language/Includetheheaderfileforinputandoutput.htm">Include the header file for input and output </a> 1.17.3. Headers 1.17.4. <A href="/Tutorial/C/0020__Language/CommonHeaders.htm">Common Headers </a> 1.17.5. <A href="/Tutorial/C/0020__Language/HeadersAddedbyC99.htm">Headers Added by C99</a> 1.17.6. <A href="/Tutorial/C/0020__Language/MacrosinHeaders.htm">Macros in Headers</a>

Headers Added by C99

Header Purpose complex.h complex arithmetic. fenv.h Gives access to the floating-point status flags and other aspects of the floating-point environment. inttypes.h Defines a standard, portable set of integer type names. Also supports functions that handle greatest-width integers. iso646.h Added in 1995 by Amendment 1. Defines macros that correspond to various operators, such as && and ^. stdbool.h Supports Boolean data types. Defines the macro bool, which helps with C++ compatibility. stdint.h Defines a standard, portable set of integer type names. This file is included by <inttypes.h>. tgmath.h Defines type-generic floating-point macros. wchar.h multibyte and wide-character functions. wctype.h multibyte and wide-character classification functions.

From C: The Complete Reference, Fourth Edition by Herbert Schildt McGraw-Hill/Osborne 2000

Include header file

<source lang="cpp">#include <stdio.h> int main(void) {

 printf("\nBe careful!!\a");
 return 0;

}</source>

Be careful!!

Include the header file for input and output

<source lang="cpp">#include <stdio.h> int main(void) {

 printf("A\n\n\nB");
 printf("\t1.\tA \n");
 printf("\t2.\tA \n");
 printf("\t3.\tA \n");
 printf("\n\t\t\b\bA\n\n");
 return 0;

}</source>

A
     
     
     B       1.      A
             2.      A
             3.      A
     
                   A

Macros in Headers

To force the compiler to use the real function: undefine the macro name using #undef.


<source lang="cpp">#undef abs</source>