You are on page 1of 22

Memory allocation for variables:

4 bits = 1 nibble

2 nibbles / 8 bits = 1 byte

1024 bytes = 1kb

1024kb = 1mb

1024mb = 1gb

1024gb = 1tb
Finding area of rectangle.

Formula  l * b
Finding sqrt() of given no.
Finding cube value:
Eg. Add two numbers without using + operator.
Swap of two numbers [ interchange ]:

Without using operators:


Using 3rd variable:
Without using 3rd variable:
We are using 2 types of variables.

1. Local variables
2. Global variables

Local variables Global variables


Declaration area Within function Top of the program
Storage area Stack area Data area
Initial values – default Garbage Int-0, float-0.000000
values Char-blank
Scope – where we can Within function only Total program
access
Life time – until what Until fun execution Until tot program
time they are active in execution
memory

Finding initial values of local and global variables:

You might also like