#include<iostream.h>
int liner(int [], int ,int );
void main ()
{
int a[1000];
int arraysize,element;
int searchkey;
cout<<"Enter how many elements in your array";
cin>>arraysize;
cout<<"enter the elements of the array ";
for(int i=0;i<arraysize;i++)
cin>>a[i];
cout<<"Enter the searchkey";
cin>>searchkey;
element=liner (a,searchkey,arraysize);
if (element!=-1)
cout<<"::::Found value in index \n"<<element<<"\n";
else
cout<<"::::value not found :::::\n";
}
int liner(int array[], int key ,int size){
int index=-1;
for(int n=0;n<size;n++)
if (array[n]==key)
index =n;
return index;
}
is this code true .
i search about the value .and return its index
but how i can input index and return its value