What is the default value of an uninitialized integer variable in C++?

  • -1
  • 0
  • 1
  • Undefined
In C++, the default value of an uninitialized integer variable is undefined. It means if you declare an integer variable and do not assign a value to it, then its value is anything; it can be any garbage value. Relying on or using this value leads to unpredictable results and is considered a bad programming practice.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *