Home / C Programming / C Preprocessor :: Discussion

Discussion :: C Preprocessor

  1. Will the following program print the message infinite number of times?

     #include
     #define INFINITELOOP while(1) 
    
     int main() 
     { 
         INFINITELOOP         
         printf("Freshergate");     
         return 0; 
    } 
    

  2. A.

    Yes

    B.

    No

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    Yes, the program prints "IndiaBIX" 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 "IndiaBIX". Then it comes to while(1) and the loop runs infinitely.


Be The First To Comment