Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
4003CEM-Exam-Practise/Variables/macros2.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
24 lines (18 sloc)
506 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
/* | |
Macros2, more of an extended part to macros. | |
*/ | |
#ifndef name // if not defined | |
#define name "Taran" // define name = "Taran" | |
#endif // close if statement | |
#define age 19 // pre define age | |
#ifdef age // if age defined | |
#define no_age 99 // define no_age = 99 | |
#endif // close if statement | |
int main() { | |
cout << name << endl; // prints "Taran" | |
cout << age << endl; // prints "19" | |
cout << no_age << endl; // prints "99" | |
return 0; // return 0 | |
} |