- The name of the variable shouldn't increase 31 characters in length. For example if you create a variable like
int abcdefghijklmnopqrstuvwxyz123456;
the compiler will flash an error since the length is exceeding 31 characters. - The first character of any variable must be an alphabet or underscore(Shift + Hyphenation). The following declaration therefore is invalid
int 1abc;
int #incorrect;
while the following is correct
int marks,int data,int _message; - Variable names must not contain a space or any other symbol except underscore.
- Variable names are case sensitive. Variable name,Name,NAME,nAme are treated as different.
- Names must be unique. Once you have used a variable name you can not use it again.
- You can not use a keyword as a variable name, for example keywords like void,int,main have a special meaning in C therefore the names must be userdefined.
Invalid variable names
1. auto
2. enum
3. int
4. return
5. switch etc.
0 comments:
Post a Comment