Can i define multiple macros in one line in c or c++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can i define multiple macros in one line in c or c++?

Like we can declare multiple integers in one line Int a,b,c; so how can i declare multiple macros?

10th Apr 2020, 11:47 AM
Gaurav Rawat
Gaurav Rawat - avatar
1 Answer
+ 4
No. Macros are different from language statements they are preprocessed and use whitespace to delimit tokens(single elements) Macro definition must start and end with a new line. A single macro can span multiple lines by using `\` but, multiple macros can't share single line. #include<stdio.h> #define spam while(1)\ printf("%d",0); int main() { spam return 0; }
10th Apr 2020, 12:44 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar