Question
Print an Array. Write a recursive function printArray that takes an array and the size of the array as arguments, prints the array, and returns
Print an Array.
Write a recursive function printArray that takes an array and the size of the array as arguments, prints the array, and returns nothing. The function should stop processing and return when it receives an array of size zero.
int main(int argc, char *argv[]) {
/////// Problem 1 Start ////////////////////////////////////// printf(" -------------------------------------------------------"); printf(" Problem 1 Start");
srand(time(NULL));
int array[SIZE_PROBLEM1]; // array to be printed
// initialize array elements to random numbers for (unsigned int loop = 0; loop
puts("Array values printed in main:");
// print array elements for (unsigned int loop = 0; loop
puts(" Array values printed in printArray:"); printArray(? ? ? ? ); puts(""); printf(" Problem 1 End");
/////// Problem 1 End //////////////////////////////////////
int main(int argc, char *argv])f Problem 1 Start /TUTIT11 printf("n- pninii ("nProblem 1 Start") srand (time (NULL)); int array [SIZE_PROBLEM1 1/ array to be printed // initialize array elenents to random numbers for (unsigned int loop0 loopSIZE_PROBLEM1 loop) array[loop] = 1 + rand() % 500; puts("Array values printed in matn:"); // print array elenents for (unsigned int loop0 loopSIZE_PROBLEM1 loop) printf("%d ", array[loop]); puts(nArray values printed in printArray:"; printArray(????); puts(""; printf("InProblem 1 End")Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started