This preview shows page 1. Sign up to view the full content.
Unformatted text preview: lue. The value of a variable usually changes when the program is being executed. When we declare a variable in a program, we actually reserve a few bytes of computer's main memory to be used for a special purpose. The following is an example of a
int integer_from_keyboard ; This source program line which introduces a variable into a program can also be called a
variable definition. The above source program line means that four bytes (32 bits) of
memory are reserved to store an integer that will be read from the keyboard, and these four
bytes can be referred to with the name integer_from_keyboard. Integers are whole
numbers that have no decimal point. Integers can be positive or negative. Variables of type
int are said to be 32-bit variables because they occupy 32 bits (four bytes) in the main
memory of the computer
A variable always has a type, such as int which is an abbreviation of the word "integer". The programmer, the person who writes the variable declarations in a program, must
give a unique name to ea...
View Full Document
This document was uploaded on 01/20/2014.
- Winter '14