Variable in C

A variable can be the best defined as a memory location in C Language. In another language, we can say that when we use some data value in a program, we store the data value in a memory space and we give a name to that memory space for an effortless access to it.

A variable is a name given to that address and memory location. The value of variables can be changed easily during execution of the program but constant value can’t.

Different data types of Variable are the following:-

a) Char
b) Int
c) float
d) double
e) void

Some Rules regarding the name of Variable.

a) Only capital letters A-Z, lowercase letters a-z, digits 0-9, and the underscore character is only allowed in a variable name.
b) Blank spaces are not allowed in naming variable names.
c) #, $ like special characters are not allowed.
d) Lowercase is preferred in naming variable names as C is case sensitive.
e) No C keywords can be used as variable names.

An easy example of C Variable Program:-

void main()
/* c program to print value of a variable */    int age = 32;
printf(“I am %d years old.\n”, age);

I am 32 years old.

Coding Tag

Coding Tag always happy to serve you in Information Technology (IT). Learn HTML, CSS, Javascript, PHP, Android, Digital Marketing, Latest IT News and many more.

Leave a Reply

Notify of