LERAN C PROGRAMMING

Learn one of the most powerful programming languages in the world and become a rockstar developer.

Keywords and Identifiers

In this tutorial, you will learn about keywords; reserved words in C programming that are part of the syntax. Also, you will learn about identifiers and how to name them.

Keywords

Keywords are preserved words that have special meaning in C language. The meaning has already been described. These meaning cannot be changed. There are total 32 keywords in C language.

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

Identifiers

In C language identifiers are the names given to variables, constants, functions and user-define data. These identifier are defined against a set of rules.

Identifiers must be unique. They are created to give a unique name to an entity to identify it during the execution of the program. For example:

int money;
double accountBalance;

Here, money and accountBalance are identifiers.

NOTE

Also remember, identifier names must be different from keywords. You cannot use int as an identifier because int is a keyword.

Rules of an identifier

  • An Indetifier can only have alphanumeric characters( a-z , A-Z , 0-9 ) and underscore( _ ).
  • The first character of an identifier can only contain alphabet( a-z , A-Z ) or underscore ( _ ).
  • Identifiers are also case sensitive in C. For example name and Name are two different identifier in C.
  • Keywords are not allowed to be used as Identifiers.
  • No special characters, such as semicolon, period, whitespaces, slash or comma are permitted to be used in or as Identifier.

Character set

In C language characters are grouped into the following catagories,

  • Letters(all alphabets a to z & A to Z).
  • Digits (all digits 0 to 9).
  • Special characters
  • , < > . _
    ( ) ; $ :
    % [ ] # ?
    ' & { } "
    ^ ! * / |
    - \ ~ +  
  • White spaces.


Previous Next
x
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Privacy Policy That's Fine