C keywords and identifiers
Keywords in C
Let’s have a look, what is the difference between keywords and identifiers in C language:
In C, Keywords are the words that are already defined. We cannot use the keywords as a variable name. We cannot use keywords as a variable name.
The name of those words(keywords) is already known by the compiler. The keywords, sometimes, are also known as ‘Reserved Words‘.
In C, there are 32 keywords available.
Identifiers in C
The identifiers in C is the name given to variable, constant or function. There are some rules that should be kept in mind while naming the identifiers:
- An identifier can have alphanumeric characters and underscore (i.e. A-Z, a-z, 0-9, _).
- The first letter of an identifier can be an alphabet or underscore. Identifiers can’t start with numbers.
- Name of an identifier can’t be a keyword i.e. int, float, double, goto, etc.
- Identifiers are case sensitive. So, var and VAR are different.
- Identifier names cannot contain any special character.
Note: You can start the name of an identifier with _(Underscore) but for best practices, please avoid as it confuses the compiler with system-defined names.