Skip to main content

Basics of Programming : Variables

Variables


Before going into definition of variable, let us consider any mathematical equation which we have studied in our schools.
For example consider, 2x + 5y = 35

We do not have to know the use of this equation, but we just know that we can substitute some values for x and y which can satisfy the equation. For example (x,y) can take values (10, 3) or (5, 4). So we can say that x and y can hold some values or x and y can are placeholders for some data.

In the same way we need something for holding data in computers. Those are called as variables.

In other words we can also say that, variables are the name given for memory location. Since data are stored in some memory location, variables are the labels for those memory locations.




Comments

Popular posts from this blog

Basics of Programming : Understanding Big Endian and Little Endian

Endianness refers to the sequential order in which bytes are arranged into larger numerical values when  stored in memory. When we consider any multi byte value we know which is its LSB ( Least Significant Byte) and which is  MSB (Most Significant Byte) based on the arrangement of LSB or MSB in lower address of the memory,  the endianness is defined. There are two ways in which multi byte values are stored in memory Little Endian Big Endian Little Endian : If the lower byte (LSB) is stored in lower address of the memory this arrangement is called  as little endian Big Endian : If the Higher byte (MSB) is stored in lower address of the memory this arrangement is called  as Big Endian. For example,   Consider a number 0x01020304, here least significant byte is 04 and most significant byte is 01. This is how the arrangement in memory with two different endianness. 0x100 ...