IDENTIFIERS:
Identifiers are
the names given to the variables, functions, data types and labels in a
program. They are
user-defined names, consisting of alphabets (letters) and numbers. Other
characters are not allowed in the name of a variable. An underscore character
can be used as a valid character in the variable name. The variable name starts
with an alphabet and its length may vary from one character to 32 characters. The first
character in a variable’s name should be an alphabet, ie., a number is
not allowed as a first character in the variable name.
The valid variable names
are:
·
x
·
length
·
x_value
·
y_value
·
a123
Lower case
letters are generally preferred.
However, upper case letters are also permitted.
Keywords (which
have special meaning in C) cannot be used as identifiers.
The following
variable names are invalid and the reasons are stated.
·
123
- The first character is a number
·
1abc
- The first character is a number
·
x
value - A blank character is used
·
x&y
- A character other than alphabet and number is used & is not a valid
character in a variable name.
·
for
- It is a keyword
No comments:
Post a Comment