{{keywords>wiki library source code example reference}}
====== define ======
Constants and Macros
#include /* including standard library */
//#include /* uncomment this for Windows */
#define identifier replacement_name
#define identifier(identifier_list) replacement_name
===== C Example 1 =====
#include /* including standard library */
//#include /* uncomment this for Windows */
#define ANSWER 42
int main(void){
printf("the answer to life the universe and everything is %d \n", ANSWER );
}
==== output example 1 ====
user@host:~$ ./define
the answer to life the universe and everything is 42
===== C Example 2=====
#include /* including standard library */
//#include /* uncomment this for Windows */
#define ANSWER 42
int print ( void )
{
printf("the answer to life the universe and everything is %d \n", ANSWER );
return 0;
}
int main(void)
{
print();
return 0;
}
==== output example 2 ====
user@host:~$ ./define
the answer to life the universe and everything is 42