From 7e0f021a9aec35fd8e6725e87e3313b101d26f5e Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Sun, 27 Jan 2008 11:37:44 +0100 Subject: Initial import (2.0.2-6) --- reference/C/SYNTAX/macros.html | 96 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 reference/C/SYNTAX/macros.html (limited to 'reference/C/SYNTAX/macros.html') diff --git a/reference/C/SYNTAX/macros.html b/reference/C/SYNTAX/macros.html new file mode 100644 index 0000000..b7726cf --- /dev/null +++ b/reference/C/SYNTAX/macros.html @@ -0,0 +1,96 @@ +Macros + + + + +
+
+

Macros

+
+
+

+Macros are built on the #define +preprocessor.

+Normally a #define would look like: +

+	#define PI 3.142
+
+But, a macro would look like this. +
+	#define SQUARE(x) x*x
+
+The main difference is that the first example is a constant and the second +is an expression. +If the macro above was used in some code it may look like this: +
+        #define SQUARE(x)  x*x
+
+        main()
+        {
+          int value=3;
+          printf("%d \n", SQUARE(value));
+        }
+
+After preprocessing the code would become: +
+        main()
+        {
+          int value=3;
+          printf("%d \n", value*value);
+        }
+
+
+

Examples:

+ + +macro example.

+


+

Notes:

+ +
+

See Also:

+ + + +

+ +


+

+

+ + + + +
+ Top + + Master Index + + Keywords + + Functions +
+
+

+


+
Martin Leslie +

+ + -- cgit v1.2.3-54-g00ecf