MCQs
When the compiler encounters a previously defined macro, it will take the result from that
execution itself.
:Macro Preprocessor only replaces occurance of macro symbol with macro symbol value,
So we can’t increment the value.
In this program, as we haven't initiailzed the variable x, we will get a output of ending digit of 4.
Output:
$ g++ mac1.cpp
$ a.out
75386824
In this program, we are using the macros to print the information about the file.
Output:
$ g++ mac2.cpp
$ a.out
Value of __LINE__ : 5
Value of __FILE__ : mac1.cpp
Value of __DATE__ : Oct 10 2012
Value of __TIME__ : 22:24:37
:In this program, we are getting the minimum number using conditional operator.
Output:
$ g++ mac3.cpp
$ a.out
The minimum value is 100.01
There are two types of macros. They are object-like and function-like.
None.
For a c++ program to execute, we need #include.
None.