a variable is the name of memory block,whose worth can be changed at anytime(runtime),we can pronounce a variable by utilizing following syntax:
[storage class ] data type variable name [=value];
here [storage-class] and [=value] are optional
note: if storage class "static" initialization value must be provided
declaration ex.1
int age=10;
if we do not storage class, variable default storage class will be auto . thus ex. 1 and 2 are same
declaration ex. 3:
Declaration Ex. 2:
int age=10;
If we do not specify storage class, variable’s default storage class will be an automatic (auto). Thus, declaration example 1 and 2 are same.
int age;
This presentation is same as revelation ex. 1 and 2 without initial value, age will have either 0 or garbage dependent on the various compilers.
some other examples:
float percentage;//a float variable
char gender;/a character variable
/an array of characters, maxi. number of characters will be 100
char name [100];
int marks [5];/an array of integer numbers to store mark of 5 subjects
0 Comments