User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







cpp:constant:define
click
to support this page (eg 0,42 € or so) Thanks.

define

  Constants and Macros
#include <iostream> /* including standard library */
 
    #define identifier     replacement_name
    #define identifier(identifier_list)     replacement_name

cpp Example 1

#include <iostream> /* including standard library */
 
 
#define ANSWER 42
 
using namespace std;
 
int main(void){
   cout << "the answer to life the universe and everything is " << ANSWER << endl;
}

output example 1

  the answer to life the universe and everything is 42 
  

C Example 2

#include <iostream> /* including standard library */
 
#define ANSWER 42
 
using namespace std;
 
int print ( void )
{
   cout << "the answer to life the universe and everything is " << ANSWER << endl;
   return 0;
}
 
int main(void)
{
   print();
return 0;
}

output example 2

  the answer to life the universe and everything is 42 
advertising
cpp/constant/define.txt · Last modified: 2012/10/12 02:10 (external edit)

Impressum