---
title: 1.5 Character Escape Sequences
description: "Escape sequences represent special characters or character values that cannot be written directly in the usual character-literal form. They begin with a backslash ``. ``` #include int main() { printf(\"First linenSecond linen\"); printf(\"Column 1tColumn 2n\"); printf(\"He said, \"Hello!\"n\"); printf(\"C:\\Program Files\\Cn\");…"
url: "https://edcret.in/docs/c-programming/basic-refreshers/1-5-character-escape-sequences/"
updated: "2026-09-06"
category: C Programming / Basic Refreshers
---

# 1.5 Character Escape Sequences

Escape sequences represent special characters or character values that cannot be written directly in the usual character-literal form. They begin with a backslash ``.

```
#include <stdio.h>

int main()
{
    printf("First linenSecond linen");
    printf("Column 1tColumn 2n");
    printf("He said, "Hello!"n");
    printf("C:\Program Files\Cn");

    return 0;
}
```

### Example Output

```
First line
Second line
Column 1    Column 2
He said, "Hello!"
C:Program FilesC
```

### Explanation

The escape sequences in the example are interpreted specially by the C compiler:

```
n
```

moves the output to the next line.

```
t
```

inserts a horizontal tab.

```
"
```

represents a double-quote character inside a string literal.

```
\
```

represents a backslash character.

### Common Escape Sequences

| Escape sequence | Meaning |
| --- | --- |
| `a` | Alert |
| `b` | Backspace |
| `f` | Form feed |
| `n` | Newline |
| `r` | Carriage return |
| `t` | Horizontal tab |
| `v` | Vertical tab |
| `\` | Backslash |
| `'` | Single quote |
| `"` | Double quote |
| `?` | Question mark |
| ` ` | Null character |

Escape sequences can also represent character values using **octal** and **hexadecimal** notation.

### Octal and Hexadecimal Escape Sequences

| Form | Meaning | Example |
| --- | --- | --- |
| `ooo` | Octal character value | `'101'` |
| `xhh...` | Hexadecimal character value | `'x41'` |

For example:

```
char a = '101';
char b = 'x41';
```

Both represent the character `A` on an ASCII execution character set.

The hexadecimal escape sequence continues consuming hexadecimal digits until a non-hexadecimal character is encountered, so its boundary can matter when writing adjacent characters.
