Which of the following are the correct preprocessor commands necessary to prevent multiple inclusions of header files? If there is an answer here that works to prevent multiple inclusion, carefully describe how it works in the explanation.
a) ```
#include “header.h”
```
b) ```
#define HEADER_H
#ifndef HEADER_H
//declarations for header.h go here
#endif
```
c) ```
#ifndef HEADER_H
#define HEADER_H
// declarations for header.h go here
#endif
```
d) ```
#ifndef HEADER_H
//declarations for header.h go here
#endif
```
c) ```
#ifndef HEADER_H
#define HEADER_H
// declarations for header.h go here
#endif
```
c) The first time header file header.h is encountered, HEADER_H will not have been defined as a preprocessor symbol, so the #ifndef HEADER_H will permit inclusion of the following lines of code. The next line #define HEADER_H defines the symbol HEADER_H, so that if this file is encountered in a later inclusion, its contents will be skipped. The necessary definitions and declarations are placed next. The #endif is the end of the #ifndef HEADER_H. It turns inclusion back on if it was off, and otherwise has no effect. a) is just the usual #include directive, it does no protection against inclusion at all, b) has swapped of the #define and #ifndef directives, and d) has omitted the #define directive.
You might also like to view...
Tab stops can be used to indent and align text in Word
Indicate whether the statement is true or false
When using the rand() function, how do you ensure that you will obtain the same series of numbers?
A. Pass srand() the same seed value. B. Call it from a different location in the code. C. Use the modulus operator with a different number after it. D. You can’t. You always obtain random numbers.
Match the following methods of connection with their description:
I. infrared II. twisted pair III. coaxial cable IV. wireless V. fiber optic A. copper wires that are insulated and twisted around each other inside insulation B. copper wire surrounded by a layer of insulation C. radio signals D. light that is invisible due to its longer wavelength E. thin, flexible, glass fibers inside of a protective covering
To hide the horizontal scroll bar, click the ________ tab, click Options, click Advanced, and uncheck Show horizontal scroll bar
A) Page Layout B) Review C) View D) File