Coupon Accepted Successfully!


Character constants

Character literals are enclosed in single quotes, e.g., 'x' and can be stored in a simple variable of chartype.

A character literal can be a plain character (e.g., 'x'), an escape sequence (e.g., '\t'), or a universal character (e.g., '\u02C0').

There are certain characters in C when they are preceded by a backslash they will have special meaning and they are used to represent like newline (\n) or tab (\t). Here, you have a list of some of such escape sequence codes:

Escape sequence



\ character


' character


" character


? character


Alert or bell




Form feed




Carriage return


Horizontal tab


Vertical tab


Octal number of one to three digits

\xhh . . .

Hexadecimal number of one or more digits


String literals

String literals or constants are enclosed in double quotes "". A string contains characters that are similar to character literals: plain characters, escape sequences, and universal characters.

You can break a long line into multiple lines using string literals and separating them using whitespaces.

Here are some examples of string literals. All the three forms are identical strings.

"hello, dear" 
"hello, \  dear" 
"hello, " "d" "ear"

Defining Constants

There are two simple ways in C to define constants:

1.     Using #define preprocessor.

2.     Using const keyword.

The const Keyword

You can use const prefix to declare constants with a specific type as follows:

const type variable = value;


Test Your Skills Now!
Take a Quiz now
Reviewer Name