can we use all macros in cpp,like #define | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

can we use all macros in cpp,like #define

29th Mar 2017, 12:30 PM
shivajiuser@
shivajiuser@ - avatar
2 Answers
29th Mar 2017, 3:13 PM
Hatsy Rei
Hatsy Rei - avatar
+ 3
yes you can, but inline functions and template function are better options over macros. 1. Inline functions ensure datatype binding. 2. Template functions facilitate generic programming.
29th Mar 2017, 12:39 PM
देवेंद्र महाजन (Devender)
देवेंद्र महाजन (Devender) - avatar