mirror of
https://github.com/TheAlgorithms/C.git
synced 2026-02-04 05:44:35 +00:00
[PR #1474] Improved linear search: return index, input validation, multpile queries #2080
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/TheAlgorithms/C/pull/1474
State: closed
Merged: No
This pull request improves the existing linear search implementation by:
Changing the return value to the index of the found element instead of just 1/0, allowing users to know the exact position.
Adding input validation to handle edge cases, such as empty arrays.
Modifying the program to allow multiple search queries without restarting.
Enhancing code readability with comments and cleaner variable names.
These improvements make the linear search function more useful and the program more user-friendly.