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.
Characters are used in forming either words or numbers or even expressions in C programming. Characters in C are classified into 4 groups:
In C programming, we can use both uppercase and lowercase letters of English language
- Uppercase Letters: A to Z
- Lowercase Letters: a to z
We can use decimal digits from 0 to 9.
C Programming allows programmer to use following special characters:
left and right brackets [ ]
question mark ?
left and right parenthesis ( )
In C Programming, white spaces contains:
- Blank Spaces
- Carriage Return
- New Line
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:
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 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.