C Keywords & Identifiers

People often confuse in between keywords and identifiers and if these terms are not properly used then it will trigger a great misunderstanding in our programming practice. In this tutorial, you will get a brief overview of what identifiers and Keywords and how they can be implemented.

What are Keywords in C?

keywords are those words whose meaning has already been defined to the C-Compiler.  A programmer cannot change the meaning of these words. The keywords cannot be used as a variable name because if we try to use a keyword as a variable then we are trying to assign a new meaning to the keyword which is not allowed by C-Compiler.

Keywords in C must be all written in small case letters as C-Language is a case sensitive language.

Some of the keywords are:

constcontinuedefaultunsigned
doubleelseenumextern
floatstructforvoid
gotoifintlong
nearregisterreturnwhile
shortsignedstaticswitch
typedefuniondovolatile
autobreak case char

 

What is an identifier in C?

An Identifier is a name given to a memory location where different constants are stored. Identifiers can be represented by one to several characters. It is a unique name assigned to an entity which includes functions,  variables, structures etc. It follows different sorts of naming conventions for its validity.

Identifiers follow certain sets of naming conventions. The rules for constructing identifiers are listed below:

  1. The identifier name can contain letters, digits and the underscore (_).                                                                                                    e.g.: radius, first_name, f16 etc.
  2. The first character of the identifier name must be a letter. The underscore is also legal first character but it is not usually advised.
  3. Identifiers names are case-sensitive.  Hence NUM, Num, and num are treated as separate identifiers.
  4. Identifiers should not have the same name as that of the functions in C Library and cannot be the same as C keyword.
SHARE C Keywords & Identifiers

You may also like...

Leave a Reply

Your email address will not be published.

Share