Programming in C
300 Chapter 13 The Preprocessor defined as 1 , the preceding statement has the effect of assigning 1 to gameOver.The pre- proces ...
The #defineStatement 301 else answer = NO; return answer; } int main (void) { int isEven (int number); if ( isEven (17) == YES ) ...
302 Chapter 13 The Preprocessor By including a definition such as #define NULL 0 in a program, you can then write more readable ...
The #defineStatement 303 int main (void) { double area (double r), circumference (double r), volume (double r); printf ("radius ...
304 Chapter 13 The Preprocessor the array—either explicitly or implicitly (by specifying a list of initializers). Subsequent pro ...
The #defineStatement 305 And if the program is written to use MAXIMUM_DATAVALUESin all cases where the size of the array was use ...
306 Chapter 13 The Preprocessor else if ( n > 0 ) /* left rotate */ { bits = value >> (kIntSize - n); result = value &l ...
The #defineStatement 307 the preprocessor would replace the occurrence of the defined name PIwith 3.141592654;.The compiler woul ...
308 Chapter 13 The Preprocessor are perfectly valid.The name TWO_PIis defined in terms of the previously defined name PI, thus o ...
The #defineStatement 309 Unlike a function, you do not define the type of the argument yhere because you are merely performing a ...
310 Chapter 13 The Preprocessor assigns the value of v^2 to y.What do you think would happen in the case of the state- ment y = ...
The #defineStatement 311 to be written.You can even use this macro in a subsequent macro definition to convert an ASCII characte ...
312 Chapter 13 The Preprocessor The #Operator If you place a #in front of a parameter in a macro definition, the preprocessor cr ...
The #includeStatement 313 The ##Operator This operator is used in macro definitions to join two tokenstogether. It is preceded ( ...
314 Chapter 13 The Preprocessor Suppose you are writing a series of programs for performing various metric conver- sions.You mig ...
The #includeStatement 315 include <stdio.h> include "metric.h" int main (void) { float liters, gallons; printf ("*** Liter ...
316 Chapter 13 The Preprocessor System Include Files It was noted that the include file <stddef.h>contains a define for NU ...
Conditional Compilation 317 If you had a large program that had many such dependencies on the particular hard- ware and/or softw ...
318 Chapter 13 The Preprocessor want to make certain it is included only once in a program, you can define a unique identifier t ...
Conditional Compilation 319 compiles program.cwith the name OSdefined as 2 .This causes the program to be com- piled to run unde ...
«
12
13
14
15
16
17
18
19
20
21
»
Free download pdf