Write a C++ program having 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 1 element.
#include <iostream>
int recursiveMinimum(int[], int);
int smallest, index;
int main()
{
int x=10;
int array1[10];
smallest=0;
index=0;
return 0;
}
int recursiveMinimum(int array[], int size)
{
if (size<=1) return -1;
if array[index]<smallest
smallest=array[index];
index++;
recursiveMinimum(array, size);
return smallest;
}
this is error i getompiling...
program8.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\project8\program8.cpp(15) : warning C4101: 'array1' : unreferenced local variable
C:\Program Files\Microsoft Visual Studio\MyProjects\project8\program8.cpp(26) : error C2061: syntax error : identifier 'array'
Error executing cl.exe.
project8.exe - 1 error(s), 1 warning(s)