Question

Consider the following C code snippet:     #include     int factorial(int
n) {         if (n == 0) {             return 1;         }         // Potential error here         return n * factorial(n);      }     int main() {         printf("%d\n", factorial(3));         return 0;     }     What will be the output or behavior of the program when factorial(3) is called?

A 6
C 3
D A segmentation fault or stack overflow
E Compilation error
Practice Next

Hey! Ask a query