Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c917fc4

Browse files
authored
fix: initialise key to avoid undefined behaviour (TheAlgorithms#2984)
1 parent b30bdd3 commit c917fc4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎search/hash_search.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ int hash_search(int key, int* counter) { // Hash lookup function
9898
/** main function */
9999
int main() {
100100
link p;
101-
int key, index, i, counter; // Key is the value to be found
101+
int key = 0, index, i, counter; // Key is the value to be found
102102
index = 0;
103103

104104
// You can write the input mode here

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /