OverIQ.com

Keywords and Identifiers

Last updated on July 27, 2020


C language Character Set #

In C language you can use the following characters. Alphabets

1
2
a, b, c, ... z
A, B, C, ... Z

Digits

0,1,2,3,4,5,6,7,8,9

Special Symbols The following table shows some special characters used extensively in C.

Character Meaning
+ Plus Sign
- Minus Sign
* Multiplication
/ Division
% Percent Sign or modulus operator
() Parentheses
{} Curly braces
[] Square brackets
= Equal Sign
, comma
; Semicolon
: colon
' Single quote
" Double quote
? Question mark
. Period or dot symbol
# Hash
^ Caret symbol
~ Tilde
! Exclamation mark
& ampersand
| pipe character

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 ?
\n newline Moves the cursor to the beginning of the next line.
\t tab Moves the cursor to the next tab stop.
\b backspace Moves the cursor back by one space on the current line.
\r carriage return Moves the cursor to the beginning of the current line.
\a bell(alert) Produces a beep sound.
\\ backslash Prints the backslash () character.
\0 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 #

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 #

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:

  1. Identifiers must consist of alphabets, digits or underscores (_) only.
  2. The first character should be an alphabet or underscore (_).
  3. The identifier should not be a keyword.
  4. Identifiers can be of any length.

C is case-sensitive language so my_var and MY_VAR are two distinct identifiers. Some examples of valid identifiers: num , _address , user_name , 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 intint is a keyword some# – pound (#) character is not allowed