User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







c:constant:define

define

  Constants and Macros
#include <stdio.h> /* including standard library */
//#include <windows.h> /* uncomment this for Windows */
 
    #define identifier     replacement_name
    #define identifier(identifier_list)     replacement_name

C Example 1

#include <stdio.h> /* including standard library */
//#include <windows.h> /* 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 <stdio.h> /* including standard library */
//#include <windows.h> /* 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 

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
c/constant/define.txt · Last modified: 2024/02/16 01:05 (external edit)

Impressum Datenschutz