Functions

Q1: Which of the following statements are correct about the program?
#include<stdio.h>

int main()
{
    printf("%p\n", main());
    return 0;
}

A It prints garbage values infinitely

B Runs infinitely without printing anything

C Error: main() cannot be called inside printf()

D No Error and print nothing

ANS:B - Runs infinitely without printing anything

In printf("%p\n", main()); it calls the main() function and then it repeats infinetly, untill stack overflow.



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.