You are on page 1of 7

78/10/05

C language
1. Identifiers are the name given to variable, constant and
function.
I. It must have characters a to z , A to Z , 0 to 9 and
underscore(-).
ii.It must start with a to z or A to Z or _
iii. The length of identifier is maximum 31.
iv. Idetifiers are case sensetive. e.g. cat and CAT are two
differenet identifiers.
v. Keyword are not allowed as identifiers.
vi. No space or special characters are allowed.
eg. _abc, xyz, Xyz, abc123 are the examples of
identifiers.
2. Variables are the names of storage area that holds
constatnts.
Rules of variables
1.Variable should start with alphabet or underscore ( _ ).
2. Spaces are not allowed in the variables.
3. Maximum length of variable is only 8 or 31.
4. Uppercase and lowecase are differnces in variables.
5. Except underscore, other symbols are not allowed in
the middle of variables.
e.g. _cat , Cat, cAT, CaT, CAT, _ram123
int cat=10 ;
float cAT=9.5;
char CAT="A";
double CaT=3333333.55;
Constant is a fixed value that is not changed during the
execution of program.
i. Integer constant is a numeric constant that doesn’t
contain decimal.
int x=5;
( x-integer variable and 5 is a integer constant)
ii. Double/Real constant/Floating constant is a numeric
constant that contains a number with decimal part.
float y=1.5;
(y is floating point variable and 1.5 is a floating
constant)
double cat=1244566.7;
iii. Character constant is a constant that contains only one
alphabet within a single quote.
char xyz='A'
(xyz is a character type of variable and A is
character constant.
iv. String constant is a group of characters enclosed in
double quotes.
char y[10]="welcome"
char x[100]="welcome to kathmandu"
Data type:
Data type refers data of different format. It indicates
what type of data to be stored/entered.
int, float, double , char are data types used.
int data type stores integer constant.
float data type stores number with decimal point. It
stores floating constant.
double data type stores number with decimal point.
char data type store a single character.
int x=5;
float y=12.56
double cat=123457.88
char rat='Y'
char [10]="welcome'
Data modifier
It changes the meaning of the basic data type to fit the
various situations. The data modifiers are short , unsigned
and long. Some examples of data modifiers are given
below.
Data Type Description Byte Range
Short int Short integer 2 -32767 to 32767
unsigned int Unsigned integer 2 0 to 65535
long int Long integer 4 -4299967296 to
4294967295
e.g. Short Int x=5;
Long int y=11111223;
CW+HW
1. What is Identifier? Write any two rules of it.
2. What is data type? Mention its types.
3. What is constant?Mention its types.
4. What is variable?List any two rules of it.
5. What is the use of the following:
a. Int x=5; It declares the variable as a integer variable
to store integer constant.
b. char X='A'
c. float y=122333.5
d. char bat[15]="bat is a bird."

Keywords:
// to calculate the area of rectangle
printf allows to print output on the screeen. printf is one
library function.
return 0 means exit . It is an optional.

You might also like