C Preprocessor

Q1:
Will the following program print the message infinite number of times?
#include<stdio.h>
#define INFINITELOOP while(1)

int main()
{
    INFINITELOOP
    printf("AptitudeCrack");
    return 0;
}

A Yes

B No

ANS:A - Yes

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



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.