0

What is macro in c++?

1st Nov 2016, 9:39 AM
Amit
2 Antworten
+ 4
You can define a macro at the beginning of file. They are used to make code shorter and easy to read. #define FOR(a) for(int i = 0; i < a; i++) means, that you just write FOR(10) in your code and that will be just like if you write for(int i = 0; i < 10; i++) This macro also shouldn't be used in development, but it is good when you need to type code fast. Hope you got the idea :)
1st Nov 2016, 11:35 AM
Daniel Oravec
Daniel Oravec - avatar
+ 2
inline functions in c++ work same as macro in c
1st Nov 2016, 9:43 AM
Shruti Singh
Shruti Singh - avatar