Home » C Programming » C Preprocessor

Will the following program print the message infinite number of times? #include #define INFINITELOOP while(1) int main() { INFINITELOOP printf("CuriousTab"); return 0; }

Correct Answer: Yes

Explanation:

Yes, the program prints "CuriousTab" and runs infinitely.


The macro INFINITELOOP while(1) replaces the text 'INFINITELOOP' by 'while(1)'


In the main function, while(1) satisfies the while condition and it prints "CuriousTab". Then it comes to while(1) and the loop runs infinitely.


← Previous Question Next Question→

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion