define preprocessor

# #define preprocessor

The #define preprocessor allows us to define symbolic names and constants. A quick example

    	#define PI 3.14159

This statement will translate every occurance of PI in the program to 3.14159. Here is a more complete example:

    	#define PI 3.14159
    	main()
    	{
       	   int r=10;
    	   float cir;
    	   cir = PI * (r*r);
    	}

This feature is partically usefull for defining 'magic' numbers.

## See Also:

- A related C keyword is enum which can be used to build lists of aliases.

- Another related C keyword is const.

- An advanced use of #define is in the creation of macros.

## Examples:

example program.

Conflict between enum and #define.

Top | Master Index | Keywords | Functions