C Programming Identifier
Table of Contents
In this chapter you will learn about identifiers and proper naming of variables.
C Identifier
An identifier is a name used to identify an entity such as a variable, function, structure, etc.
In C programming, identifiers must be unique. They are mainly created to identify an entity through a unique name during program execution. For example:
int money;
double accountBalance;
Here money and accountBalance are identifiers.
Remember, C keywords can never be used to name identifiers.
For example, you can’t use double as an identifier if you want because it’s a keywords.
Conventions for Naming Identifiers
- A valid identifier can contain letters (uppercase or lowercase), digits, and underscores(_).
- Identifier names must begin with letters or underscores. However, starting the identifier name with an underscore is discouraged.
- The identifier name can be of any lenght. However, the compiler chooses the first 31 characters as the identifier name.
Programming in a better way
You can choose any name for the identifier without keywords. However, if you give the identifier a meaningful name it will be easier for you and your future programmers to understand.
Pingback: C Programming Variable -