Question: Problem 2 Write a recursive function stringReverse that takes a character array as an argument, prints it back to front and returns nothing. The function
Problem 2
Write a recursive function stringReverse that takes a character array as an argument, prints it back to front and returns nothing. The function should stop processing and return when the terminating null character of the string is encountered.
Problem 3
Write a recursive function recursiveMinimum that takes an integer array and the array size as arguments and returns the smallest element of the array. The function should stop processing and return when it receives an array of one element.
/////// Problem 2 Start ////////////////////////////////////// printf(" -------------------------------------------------------"); printf(" Problem 2 Start ");
// initialize string strArray char strArray[SIZE_PROBLEM2] = "Print this string backward.";
// display original string for (? ? ? ? ) { ? ? ? ? ); }
puts(""); stringReverse(strArray); // reverse the string puts(""); printf(" Problem 2 End");
/////// Problem 2 End //////////////////////////////////////
/////// Problem 3 Start ////////////////////////////////////// printf(" -------------------------------------------------------"); printf(" Problem 3 Start");
srand(time(NULL));
int array_p3[? ? ? ? ]; // array to be searched
// initialize elements of array to random numbers for (? ? ? ? ) { ? ? ? ? }
printf("Array members are: ");
// display array for (? ? ? ? ) { ? ? ? ? }
// find and display smallest array element puts(""); int smallest = recursiveMinimum(? ? ? ? ); printf(" Smallest element is: %d ", smallest); printf(" Problem 3 End");
/////// Problem 3 End //////////////////////////////////////
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
