+ 4
What is the role of #define in c++?
9 Respostas
+ 5
#define is a shortcut for a value that is used over and over in your code.
For example:
you #define TAX as 20 and from now on, instead of saying 20, you just say TAX.
example:
i = 300 + 20
is the same as
i = 300 + TAX
+ 3
In c++ there are some pre processor directives like we always use header file #include. Like this #define is also an preprocessor directive and with the help of which we create symbolic constants and these constant are known as macros
+ 2
It is used to define a macro in c++.
Mostly used to make changes in our code at last moment .
+ 1
Thank you :)
+ 1
welcome
+ 1
sorry but I have little bit of knowledge about C++.
0
@Amandeep Saluja what is a macro?
0
@Shahar Levy thank you :)
@Ajay It is a pleasure for me too.
0
#define is one of the preprocessors in C++ to define a variable as constant and which the varible can be use anywhere in the program.