#include <stdio>
using std::cout;
void CountDown(int N) {
if(N == 0) {
return;
}
cout << N;
CountDown(N-1);
//return;
}
In the code the output I get when return is commented is same as when not commented.
What I want to ask is whether it makes a difference if I use a return;
statement at the end of the function (since it would implicitly return to the function, which called it, at the end of the braces)?
Another question:
What if had a function with a return type instead of void here.
I tried it with a function. The value was wrong.But there was no compiler error.
So using simply a return;
makes no difference right? Except when I want to prematurely end the function right?