+ 1

What is macro? With examples.

26th Jan 2017, 8:49 AM
Rishabh Rai
Rishabh Rai - avatar
4 Respostas
+ 2
macro is anything used with #define "A macro is a fragment of code which has been given a name. Whenever the name is used, it is replaced by the contents of the macro" .... #define MYCONSTANT 3 #define MYFUNCTION(x) x+5 .... int main(){ cout << MYCONSTANT; cout << MYFUNCTION(6); return 0; } these are replaced just before the program compiles. int main(){ cout << 3; cout << 6+5; return 0; }
26th Jan 2017, 9:05 AM
Chadi Trad
Chadi Trad - avatar
+ 4
macaroni for example: macaroni and cheese
26th Jan 2017, 9:06 AM
Ahri Fox
Ahri Fox - avatar
+ 4
I gave you definition. macro = macaroni
26th Jan 2017, 9:09 AM
Ahri Fox
Ahri Fox - avatar
+ 1
macro definition pls.
26th Jan 2017, 9:08 AM
Rishabh Rai
Rishabh Rai - avatar