adplus-dvertising
frame-decoration

Question

What is the output of this C code?
#include <stdio.h>
    void main()
    {
        register int x = 0;
        if (x < 2)
        {
            x++;
            main();
        }
    }

a.

Segmentation fault

b.

main is called twice

c.

main is called once

d.

main is called thrice

Posted under Functions C Programming

Answer: (a).Segmentation fault

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this C code? #include <stdio.h> void main() { register int x = 0; if (x < 2) { x++;...