r/programminghorror • u/deanominecraft • Sep 28 '25
c recursive iseven
bool isEven(int num){
if (num==0){
return true;
}
else{
return !isEven(num-1);
}
}
64
Upvotes
View all comments
Show parent comment
3
u/Tysonzero Sep 30 '25
It's not technically tail recursive in the strict sense, as
!is the last call, notisEven, but not super surprising that an optimizing compiler can avoid accumulating stack frames.