mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-24 10:01:38 +00:00
parent
a6e460618d
commit
a5c23e8af4
@ -756,8 +756,14 @@ as the C file.
|
|||||||
/* Like c source files macros can be defined in headers and used in files */
|
/* Like c source files macros can be defined in headers and used in files */
|
||||||
/* that include this header file. */
|
/* that include this header file. */
|
||||||
#define EXAMPLE_NAME "Dennis Ritchie"
|
#define EXAMPLE_NAME "Dennis Ritchie"
|
||||||
|
|
||||||
/* Function macros can also be defined. */
|
/* Function macros can also be defined. */
|
||||||
#define ADD(a, b) (a + b)
|
#define ADD(a, b) ((a) + (b))
|
||||||
|
|
||||||
|
/* Notice the parenthesis surrounding the arguments -- this is important to */
|
||||||
|
/* ensure that a and b don't get expanded in an unexpected way (e.g. consider */
|
||||||
|
/* MUL(x, y) (x * y); MUL(1 + 2, 3) would expand to (1 + 2 * 3), yielding an */
|
||||||
|
/* incorrect result) */
|
||||||
|
|
||||||
/* Structs and typedefs can be used for consistency between files. */
|
/* Structs and typedefs can be used for consistency between files. */
|
||||||
typedef struct Node
|
typedef struct Node
|
||||||
|
Loading…
Reference in New Issue
Block a user