C Programming - C Preprocessor - Discussion

12. 

A header file contains macros, structure declaration and function prototypes.

[A]. True
[B]. False

Answer: Option A

Explanation:

True, the header file contains classes, function prototypes, structure declaration, macros.


Kiran said: (Oct 25, 2013)  
Can anyone give some example for this?

Reshu said: (Jul 12, 2015)  
A look through any of the standard header files can give you a good idea of the sort of information found in them. The most common forms of header contents include the following:.

Manifest constants : A typical stdio.h file, for instance, defines EOF, NULL, and BUFSIZ (the size of the standard I/O buffer).

Macro functions : For example, getchar() is usually defined as getc (stdin) , getc() is usually defined as a rather complex macro, and the ctype. H header typically contains macro definitions for the ctype functions.

Function declarations : The string.h header (strings.h on some older systems) , for example, contains function declarations for the family of string functions. Under ANSI C, the declarations are in function prototype form.

Structure template definitions : The standard I/O functions make use of a FILE structure containing information about a file and its associated buffer. The stdio.h file holds the declaration for this structure.

Type definitions : You might recall that the standard I/O functions use a pointer-to-FILE argument. Typically, stdio.h uses a #define or a typedef to make FILE represent a pointer to a structure. Similarly, the size_t and time_t types are defined in header files.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.