Variables are assigned to memory positions that may contain leftover data from previous operations, so it is necessary to initialize variables by assigning them starting values to erase this data. For example, initializing the variable "Bonus" to 0 erases any existing data in that memory position and sets the starting value for any calculations or operations involving that variable.
Variables are assigned to memory positions that may contain leftover data from previous operations, so it is necessary to initialize variables by assigning them starting values to erase this data. For example, initializing the variable "Bonus" to 0 erases any existing data in that memory position and sets the starting value for any calculations or operations involving that variable.
Variables are assigned to memory positions that may contain leftover data from previous operations, so it is necessary to initialize variables by assigning them starting values to erase this data. For example, initializing the variable "Bonus" to 0 erases any existing data in that memory position and sets the starting value for any calculations or operations involving that variable.
It may sometimes be necessary or wise to initialize a
variable, that is, to give the variable a starting or initial value. NB. A variable is assigned to a position in memory that is not used. That position may nevertheless have data stored there (from some previous operation); this data therefore, needs to be erased by setting an initial value for the variable. Eg. Initialize variable Bonus = 0