int LinearSearch(struct arr, int key) { int i; for(i=0; i<arr.length; i++) { if (key == arr.A[i]) return i; } return -1; } int main() { struct Array arr={{2,3,4,5,6},10,5}; printf("%d\n", LinearSearch(arr,15)); Display(arr); return 0; }
int LinearSearch(struct arr, int key) { int i; for(i=0; i<arr.length; i++) { if (key == arr.A[i]) return i; } return -1; } int main() { struct Array arr={{2,3,4,5,6},10,5}; printf("%d\n", LinearSearch(arr,15)); Display(arr); return 0; }