C Keywords & Identifiers

Keywords in C

Keywords are nothing but just some words that are predefined in the C compiler that has special meanings for each keyword. These meanings can not be changed. C has a total of 32 keywords. So far we have used some keyword in our previous Hello World program. like main, return, int, etc. See below the full list of keywords in the table below:

auto break case const
char continue default do
double else enum extern
float for goto if
int long register return
short signed sizeof static
struct switch typedef union
unsigned volatile void while

The remain keywords that we didn’t use in any previous example, we will use it in further lessons. For now, just review the reserved keywords. Remember that reserved keywords can not be used in identifiers naming. Now let’s see what is an identifier and why keywords can not be used in identifiers.

Identifiers in C

Identifiers are the user-defined data in C.  We already leaned whats are identifiers. Declaring variables, declaring functions are basically called identifiers. As identifiers are defined by the coder, that’s why there are some rules for naming an identifier.

The rules of naming identifiers are similar to naming variables that we have learned in the variable lesson. But variables are a superset of identifiers. Because identifiers are also self-defined or it is named by the user.

Rules for naming identifiers:
  1. Keywords are not allowed to be used as identifiers.
  2. Identifiers can contain only underscore and alphanumeric characters.
  3. The first character must be an underscore or alphabet
  4. White space is not allowed for naming identifiers
  5. Every individual  identifier must be unique
  6. Identifiers are case-sensitive
  7. Special characters like comma, semicolon, etc are not allowed.

If we want to declare a variable, then we must follow the rules of identifiers naming. Because variables are subset of identifiers.


char[120] myVariable = "Hello PrograCoding!";

hin the above string variable we followed the rules of identifier while naming the variable name: myVariable

« Previous Next »