What is variable in c and how to use it?

Posted on Updated on


Variable means a word which holds some memory in computer, according to then type of data the variables types are different. there are many types of variables available in c like Integer, Float, Double, Long double, Char etc.
Syntax(How to define a Variable) : –
1.Variable type 2.Variable name 3.Value of variable(Optional);
Ex:- int A = 10; or int a;
float b = 20.25; or float b;
double c = 30.33333333; or double c;
same for all types of variable.

Note:- The size of memory acquire by a variable is depends upon the variable type.

=> Integer stands for numeric data, a no which doesn’t contain values after point ex :- 10,20,30,40 etc, it occupy 2 bytes in memory and it’s range is -32768 to +32767.

=> float is stands for numeric data, a no with 6 digits of precision ex :- 10.333333, 15.333333 etc, it occupy 4 bytes in memory and it’s range is 1.17549E-38 to 3.40282E+38.

=> double stands for numeric data type which can hold more precision then float and it occupy 8 bytes in memory, The range is 2.22507E–308 to 1.79769E+308.

=> Long double stands for numeric data type and it occupy 10 bytes in memory.

=> Char stands for character data types which allows to store characters like a-z, A-Z, 0-9.
Note:- It can’t be used to store special symbols like $,#,*,^,% etc.

Further will be discussed in Next post………….

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s