Biology Forums - Study Force

Science-Related Homework Help Computer Studies Topic started by: Heff on Sep 3, 2017



Title: How many times will the following function call itself, if the value 5 is passed as the ...
Post by: Heff on Sep 3, 2017
How many times will the following function call itself, if the value 5 is passed as the argument?

   void showMessage(int n)
   {
       if (n > 0)
       {
           cout << "Good day!" << endl;
           showMessage(n - 1);
       }
   }

A) 1
B) 4
C) 5
D) An infinite number of times


Title: Re: How many times will the following function call itself, if the value 5 is passed as the ...
Post by: ade9ja on Sep 3, 2017
Content hidden