Skip to content

Tag Archives: cpp-macros

Header Guards in C++ are conditional compilation directives that help to avoid errors that arise when the same function or variable is defined more than… Read More
A macro is a piece of code in a program that is replaced by the value of the macro. Macro is defined by #define directive.… Read More
99.9% of the C++ programs use macros. Unless you are making a basic file you have to write #include, which is a macro that pastes… Read More
errno is a preprocessor macro used for error indication. The value of errno is set to zero at program startup, and any function of the… Read More
Shortcode is ideal in competitive programming because programs should be written as fast as possible. Because of this, competitive programmers often define shorter names for… Read More
C/C++ Preprocessor directives basics Preprocessor directives: In almost every program we come across in C/C++, we see a few lines at the top of the… Read More
Prerequisite – Macros What is the output of following program? #include <iostream> using namespace std;    #define a 10    int main() {     int a… Read More
As the name suggests Preprocessors are programs that process our source code before compilation. There are a number of steps involved between writing a program… Read More
Macros are pre-processed which means that all the macros would be processed before your program compiles. However, functions are not preprocessed but compiled. See the… Read More
How to print and store a variable name in string variable? We strongly recommend you to minimize your browser and try this yourself first In… Read More
Give a = 12 and b = 36 write a C function/macro that returns 3612 without using arithmetic, strings and predefined functions. We strongly recommend… Read More
#define is a preprocessor directive. Things defined by #define are replaced by the preprocessor before compilation begins.  const variables are actual variables like other normal… Read More
In a C program, all lines that start with # are processed by preprocessor which is a special program invoked by the compiler. by this… Read More
Predict the output of the below program #define square(x) x*x int main() {   int x;   x = 36/square(6);   printf("%d",x);       getchar();   return 0; } Output:… Read More