Wednesday, December 17, 2008

Rules for constructing variable name in C language

Though the rules for constructing different types of constant are different,yet the rules of constructing different types of variable are same, which are as follows:
1. The length of a variable name should be minimum of one character and maximum of 8 character. Some compiler also allow variable name up to forty characters.
2. Only alphabet, digits and underscore can be used to name a variable.

3. The first character in a variable name must be an alphabet.
4. No comma or blanks are allowed with in a variable name.
5. No special symbol other than underscore in allowed in naming a variable.
Ex.:
Val
in_Val
n95
stud_class_5
This rule remains same for all variable types variable.e., both for primary and secondary type.

No comments:

Post a Comment

Please give your valuable comments or queries if you fell its helpful or if you like the contents of the site. Thanks...

Post a Comment