Friday, March 20, 2015

What are the Variables in CLanguage?

variables are the data holders .. they hold the data according to their data type..
syntax of variable declaration in c is

datatype variable1,variable2;
here the values to the variables can be assigned at the declaration itself or later

Assignment of values to the variables

datatype variable1=value,variable2=value;
or
datatype variable;
variable=value;

Rules to declare variables in c:

* a variable should not be a keyword
*a variable should not end with $
*a variable should not have blank spaces


User defined variables:
typedef
It is used to rename the pre defined variables but it dont change the size
ex: typedef int units;
so here units refer the datatype int

enum:
enum is the special datatype in c which gives automated values to the variables
declaration:enum identifier v1,v2..vn;
here v1=0;v2=1...vn=n; are automatically assigned

No comments:

Post a Comment