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

🎓
Think You're Ready for RBI Grade B?
RBI Grade B 2026 Phase 1 Memory Based Paper
  • 200 Questions with Detailed Solutions
  • Section-wise Coverage (GA, English, Quant & Reasoning)