Variables & Constants
Computer Science: OCR A Level, topic 7.1.1
Variables and Constants
We may need to store data in the memory as part of our program.

The memory
- The memory can be thought of as split up into 'blocks' called words.
- Each word is usually 32 or 64 bits long.
- To access a piece of memory, you have to use its memory address which looks something like 0x9FFF000F.

Variables
- To make life easier for programmers, we can give a memory location a symbolic name called an identifier.
- The identifier is a word that describes what we will store in that memory location.
- A variable is a named storage location whose value can be changed while the program is running.

Constants
- A constant is a named location in memory that can be used to store a value which does not change while the program is run.

Assignment
- The process of setting a value to a variable or a constant is known as assignment.
- Assignment is usually shown using an equals sign, e.g:
- height = 39.
Test yourself on Variables & Constants
Which symbol is commonly used for assignment?
What is an identifier?