Skip to content

Commit 825d2dc

Browse files
committed
fix: initialise key to avoid undefined behaviour
1 parent 93c64b5 commit 825d2dc

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)