Keywords and Identifiers
C language character set
In C language you can use the following characters.
a, b, c, ... z A, B, C, ... Z
The following table shows some special characters used extensively in C.
|%||Percent Sign or modulus operator|
|.||Period or dot symbol|
Escape Sequences are used to print some special characters in the console which can't be printed by directly using the keyboard such as newline, tab etc. Escape Sequences consists of 2 or more characters, the first character is
\ and the second character varies according to the need. Here are some common escape sequences.
|Escape Sequence||Meaning||What it does ?|
|\n||newline||\n character moves the cursor to the beginning of the next line|
|\t||tab||\t character moves the to the next tab stop|
|\b||backspace||\b character moves the cursor back to the previous position|
|\r||carriage return||\r character moves the cursor to the beginning of the current line|
|\a||bell(alert)||\a character produces a beep sound|
|\\||backslash||\\ character is used to print single backslash (\ ) character|
|\0||null||\0 character denotes a null character|
|\'||single quote||\' character is used to print single quote(' )|
|\"||double quote||\" character is used to print double quote(" )|
Note: newline (
\n ), backspace (
\b ), Carriage return (
\r ), tab (
\t ), space (
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:
Examples of invalid identifiers:
1digit – an identifier must not start with a number
my var – an identifier must not contain space between names
int is a keyword,
some# – pound(
#) character is not allowed