> Why assign variables initial values (initialization)?

Why assign variables initial values (initialization)?

Posted at: 2014-12-18 
ut<< "Enter your first number";

int FirstNumber = 0;

cin >> FirstNumber;

Why is FirstNumber assigned the initial value of 0?

In coding, it's often a good practice. Unitialized variables have 'junk' values

which can creep into code and cause silent bugs. As Husoski says, it's pretty silly,

here.

>

> John (gnujohn)

There's no reason for it in this case. Must just be a habit on the part of whoever wrote the code.

cout<< "Enter your first number";

int FirstNumber = 0;

cin >> FirstNumber;

Why is FirstNumber assigned the initial value of 0?