Question: The following function is written incorrectly: int factorial ( int n ) { if ( n = = 0 ) return 1 ; return n

The following function is written incorrectly:
int factorial (int n){
if (n ==0) return 1;
return n * factorial (n);
}
What will be the result of calling it with a large integer?
Group of answer choices
The function will not compile.
Calling this function causes an infinite recursion; it will continue to run until aborted by the user.
The integer returned will be off by one.
It cannot be determined if a stack overflow error will occur without knowing the stack's size and the initial value of n.
It will always overflow the stack.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!