C&S 2024 Exam - Question 1 (c)
itsLu
c_cpp
2 years ago
225 B
24
Indexable
#include <iostream>
using namespace std;
int linearSearch(int *arr , int arraySize , int key)
{
for(int k = 0 ; k < arraySize ; k++)
{
if(arr[k] == key)
return k;
}
return -1;
}Editor is loading...
Leave a Comment