Characters Sets, Keywords and Identifiers in C Programming

In this section, you will learn about character set(characters that are valid), keywords(reserved words) and identifiers(user-defined names) of C Programming Language.

Character Set In C

Characters are used in forming either words or numbers or even expressions in C programming. Characters in C are classified into 4 groups:

Letters

In C programming, we can use both uppercase and lowercase letters of English language

  • Uppercase Letters: A to Z
  • Lowercase Letters: a to z

Digits

We can use decimal digits from 0 to 9.

Special Characters

C Programming allows programmer to use following special characters:

comma ,

slash /

period .

backslash

semicolon ;

percentage %

colon :

left and right brackets [ ]

question mark ?

left and right parenthesis ( )

White Spaces

In C Programming, white spaces contains:

  • Blank Spaces
  • Tab
  • Carriage Return
  • New Line

Character Set in C

Keywords

Keywords are special words in C programming which have their own predefined meaning. The functions and meanings of these words cannot be altered. Some keywords in C Programming are:

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

Consider an example below:

int age;
float height;

Here, int is a keyword which declares age as a variable of integer data type.

Similarly, float is also a keyword which declares height is a variable of floating integer data type.

To learn more about keywords, visit All Keywords in C Programming.

Identifiers

Identifiers are user-defined names of variables, functions and arrays. It comprises of combination of letters and digits. In C Programming, while declaring identifiers, certain rules have to be followed viz.

  • It must begin with an alphabet or an underscore and not digits.
  • It must contain only alphabets, digits or underscore.
  • A keyword cannot be used as an identifier
  • Must not contain white space.
  • Only first 31 characters are significant.

Let us again consider an example

int age1;
float height_in_feet;

Here, age1 is an identifier of integer data type.

Similarly height_feet is also an identifier but of floating integer data type,

Note: Every word in C program is either a keyword or an identifier.