If you write int x; and use x before assigning a value, you get whatever random data was in memory. This might be 0, or 94832, or -12. Your program does not crash. It just uses the garbage value in calculations, giving wrong answers that change every time you run the code.
Example: int sum; sum = sum + 5; adds 5 to garbage. You wanted int sum = 0; sum = sum + 5; to add 5 to 0. Always initialize variables.