vault backup: 2024-11-10 20:56:06
This commit is contained in:
parent
86ecc96c92
commit
081dfe7116
@ -18,6 +18,7 @@ Yes, `""` is a path relative to the current file, whereas `<>` is a path to the
|
|||||||
|
|
||||||
> **4.** Assume that `debug.h` is a header file with the following contents...
|
> **4.** Assume that `debug.h` is a header file with the following contents...
|
||||||
>(a). What is the output when the program is executed?
|
>(a). What is the output when the program is executed?
|
||||||
|
|
||||||
```
|
```
|
||||||
Output if DEBUG is defined:
|
Output if DEBUG is defined:
|
||||||
Value of i: 1
|
Value of i: 1
|
||||||
@ -25,5 +26,13 @@ Value of j: 2
|
|||||||
Value of i + j: 3
|
Value of i + j: 3
|
||||||
Value of 2 * i + j - k: 1
|
Value of 2 * i + j - k: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
> (b). What is the output if the `#define` directive is removed from `testdebug.c`?
|
> (b). What is the output if the `#define` directive is removed from `testdebug.c`?
|
||||||
>
|
|
||||||
|
```
|
||||||
|
Output if DEBUG is not defined:
|
||||||
|
```
|
||||||
|
|
||||||
|
> (c). Explain why the output is different in parts (a) and (b)
|
||||||
|
|
||||||
|
When `DEBUG` is defined, any instances of the `PRINT_DEBUG` token are replaced with a `printf` call during compile time, but when it's not defined, they're replaced with nothing.
|
Loading…
Reference in New Issue
Block a user