Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slight change in size #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions searching/linearSearch.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@ int linearSearch(int *a, int n, int key);

int main(){
//variable declaration
int arr[5], i, key;
int arr[10], i, key;

//input
printf("Enter the array elements: ");
for(i = 0; i < 5; i++)
for(i = 0; i < 10; i++)
scanf("%d", &arr[i]);
printf("Enter key: ");
scanf("%d", &key);

//search
i = linearSearch(arr, 5, key);
i = linearSearch(arr, 10, key);

//output
if(i == -1)
printf("Key not found.\n");
else
printf("Key at index: %d\n", i);

return 0;
}

Expand Down