#include <iostream>
using namespace std;
int screw(int x){
if(x==1)
return x;
else
screw(x-1);
}
int main(){
cout<<screw(5)<< endl;
return 0;
}
Output of this code: 1 Can anyone explain how the screw(5), screw(4), screw(3), screw(2) are returning 1 when there is no return statement in "else" part of their code. Use of call stack to explain would be highly appreciated. Any insights about basics related to it are very much welcomed.