Keywords and Identifiers
Last updated on July 27, 2020
C language Character Set #
In C language you can use the following characters. Alphabets
a, b, c, ... z A, B, C, ... Z
Special Symbols The following table shows some special characters used extensively in C.
||Percent Sign or modulus operator|
||Period or dot symbol|
Escape Sequences #
Escape Sequences are used to print some special characters which can't be printed directly using the keyboard. For example, newline, tab, carriage return etc. An Escape Sequences consists of a backslash character (
\\) followed by a particular escape character. The following table lists common escape sequences.
|Escape Sequence||Meaning||What it does ?|
||newline||Moves the cursor to the beginning of the next line.|
||tab||Moves the cursor to the next tab stop.|
||backspace||Moves the cursor back by one space on the current line.|
||carriage return||Moves the cursor to the beginning of the current line.|
||bell(alert)||Produces a beep sound.|
||backslash||Prints the backslash () character.|
||null||\0 character denotes a null character.|
||single quote||Prints the single quote (') character.|
||double quote||Prints the double quote (") character.|
! newline (
\n), backspace (
\b), Carriage return (
\r), tab (
\t), space (
) are known as whitespace characters.
Keywords are some reserved words that C language use for denoting something specific. In C, Keywords are written in lowercase. C has only 32 Keywords.
Identifiers are the words we use to name entities like variables, functions, array, structure, symbolic constant etc. The rules for naming identifiers are as follows:
- Identifiers must consist of alphabets, digits or underscores (
- The first character should be an alphabet or underscore (
- The identifier should not be a keyword.
- Identifiers can be of any length.
C is case-sensitive language so
MY_VAR are two distinct identifiers. Some examples of valid identifiers:
email_1 Examples of invalid identifiers:
1digit – an identifier must not start with a number
my var – an identifier must not contain a space character
int is a keyword
some# – pound (
#) character is not allowed