- The elements of a program are named with a specific name called as Identifiers.
- Identifiers used to identify the variables, functions, pointers and some user-defined datatypes.
- Identifiers in a program are unique.
- Ex: int mark;
- Here mark is an identifier.
- There are some rules for the Identifiers.
Rules for Identifiers:
- The name of an Identifier always starts with an alphabet or underscore ( _ ).
- It must not be a keyword.
- There mustn't have any space in between any alphabets.
- Identifiers are case sensitive.
- Punctuation and special characters aren’t allowed except underscore.
- It may be the combination of alphabets and digits, but the 1st letter must be an alphabet.
Example of Identifiers:
int x;
float percentage;
double simple_interest;
string name1;
string name2;
int _number2;
- Here x, percentage, simple_interest, name1 and name2 are the identifiers.
- Identifiers may be a single character, word, combination of word and number.
- The name of identifier must start with alphabet, but we could use _ from the symbols.
No comments:
Post a Comment