Skip to content

Commit 6b0fea6

Browse files
authored
Update bullsAndCows.cpp
1 parent 7078768 commit 6b0fea6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

algorithms/cpp/bullsAndCows/bullsAndCows.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ class Solution {
4242
}
4343

4444
string getHint01(string secret, string guess) {
45-
int appears_in_secret[10], appears_in_guess[10], bulls[10];
46-
int total_bulls, total_cows;
45+
int appears_in_secret[10] = {0}, appears_in_guess[10] = {0}, bulls[10] = {0};
46+
int total_bulls = 0, total_cows = 0;
4747
for(int i = 0; i < secret.size(); i++)
4848
appears_in_secret[secret[i] - '0']++;
4949
for(int i = 0; i < guess.size(); i++)

0 commit comments

Comments
 (0)