Identifiers in C Programming Language
Notes:
Identifiers in C Programming Language
Identifier: (User defined names)
Identifier is a sequence of characters; which help us to identify specific part of a program.
Identifiers are names given to the program elements by the programmers.
Ex:
name of a variable
name of a constant
name of an array
name of a function
name of a data structure
etc.
Naming conventions:
- are the rules or guidelines for writing identifier names
1. Identifiers should be meaningful and descriptive.
2. Keywords should never be used as identifiers.
3. The first character must be an alphabet or underscore.
4. The first character should not be a number.
5. All succeeding characters can be alphabets, a digits, or underscores.
6. No special characters are allowed except an underscore, not even space.
7. More than one successive underscores should not be used
8. More than one identifier names should not be same in the same scope.
9. Identifiers are case sensitive.
Ex:
Valid: s, p, Num, num, score, _flag, player9, price, SCREEN_WIDTH, setWidth, Student etc.
Invalid: 9thplayer, a$b, _ _flag, player health, continue, while, break, etc.