私はこのコードを実行すると、出力は次のようになります。カウンタがインクリメントするのはなぜですか?
hello5
hello4
hello3
hello2
hello1
0
1
2
3
4
私はhello1
まで理解が、私はそれが増加している理由を知りません。誰かが私にこれを説明することはできますか?それが増加していないです
#include <iostream>
#include <iomanip>
using namespace std;
void myFunction(int counter)
{
if(counter == 0)
return;
else
{
cout << "hello" << counter << endl;
myFunction(--counter);
cout << counter << endl;
return;
}
}
int main()
{
myFunction(5);
return 0;
}