Computer Fundamentals Notes by Nida Afaq Warsi
Computer Fundamentals Notes by Nida Afaq Warsi
Computer Fundamentals Notes by Nida Afaq Warsi
Variables are references that stand in for a value that is contained at a certain memory address.
Variables are said to have a value and may have a data type.
Example:
Variable X
Each cell in the above diagram represents a memory location, and can be excessed through a
memory address.
Each cell represents a unit of memory called a byte. Each byte consists of 8 bits.
Eight bits is a convenient power of two allowing the values 0 through 255 to be stored on one
8
byte.(As 2 = 256, thus including 0 a total of 255 values can be stored)
To store a value greater than 255, we combine two cells and treat them as a single number.
Each cell can now store 255 values each thus a maximum value of 232-1 = 65535 can be stored
using two bytes.
Example:
Z
X
Y
8
Z= 2 Y +X
The order in which this sequence of bytes is stored is called Little Endian. In this order the "little
end" or the least significant value in the sequence is stored first. Thus X being the least
significant is stored before Y.
Example:
To store the number Z = 1000 the value of X= 232 while Y = 3.
The table below shows some of the values of X and Y with the corresponding value of Z.
255
255
256
257
255
511
255
255
65535
Variable
Name
Example X,Y
Data Type
Size
Value
X+4=Y+7
Root(a,b,c) = -b +b2-4ac
2a
Div(Sum(Sqrt(Sum(Prod(b,b),(Prod(Prod(a,c),-4))))),Prod(b,-1))Prod(2,a)
Start from the center, in the above example from the product of a and c and
work your way outwards.
x
The above symbols mean mapping from two sets of real number to one set.
Function add is written in the beginning.
Symbol Indicates that the two parameters to be added are real
numbers, and the resultant value is also a real number.
+:
The above symbolic representation indicates that two integers add to give
another integer.
x
Data Types
Character (char)
Integer (int)
Long
16 0r 32 bit integer
value
32 bit integer value
Float
Simple
Double
More precise
return 0;