Question: Write a function that normally takes one argument, the address of a string, and prints that string once. However, if a second, type int, argument
Write a function that normally takes one argument, the address of a string, and prints that string once. However, if a second, type int, argument is provided and is nonzero, the function should print the string a number of times equal to the number of times that function has been called at that point. (Note that the number of times the string is printed is not equal to the value of the second argument; it is equal to the number of times the function has been called.) Yes, this is a silly function, but it makes you use some of the techniques discussed in this chapter. Use the function in a simple program that demonstrates how the function works.
Step by Step Solution
3.50 Rating (170 Votes )
There are 3 Steps involved in it
1 Define a counter variable to count the number of times a parameter is passed 2 Define a function t... View full answer
Get step-by-step solutions from verified subject matter experts
