Linear search program in c++ using recursion

Levels of difficulty: / perform operation:

This program runs linear search recursively in an array using recursion in c++ code

How Program Works :
Program takes size of array
Input elements in array
Passing array, key and size to the recursive function recursiveLinearSearch(int array[],int key, int size)
Recursive function calls it self until certain conditions fulfill
Function returns 1 if record found in array else returns -1

C++ Program

    using namespace std;
int recursiveLinearSearch(int array[],int key,int size) {
	if(size <0) {
		return -1;
	} else if(array[size]==key) {
		return 1;
	} else {
		return recursiveLinearSearch(array,key,size);
int main() {
	cout<<"Enter The Size Of Array:   ";
	int size;
	int array[size], key,i;
	// Taking Input In Array
	for (int j=0;j<size;j++) {
		cout<<"Enter "<<j<<" Element : ";
	//Your Entered Array Is
	for (int a=0;a<size;a++) {
		cout<<"array[ "<<a<<" ]  =  ";
	cout<<"Enter Key To Search  in Array";
	int result;
	if(result==1) {
		cout<<"Key Found in Array  ";
	} else {
		cout<<"Key NOT Found in Array  ";
	return 0;