MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / LinearSearch

Function LinearSearch

Arrays/07_Linearsearch.c:15–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13 printf("%d ",arr.A[i]);
14}
15int LinearSearch (struct Array arr, int key)
16{
17 int i;
18 for (i=0;i<arr.length;i++)
19 {
20 if (key==arr.A[i]) // formula
21 return i;
22 }
23 return -1;
24}
25int main ()
26{
27 struct Array arr1= {{2,3,4,2,3,4,5,88,9 },20,5 };

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected