ELI5: Explain Like I'm 5

Escape sequences in C

Imagine you wanted to write a secret message to your friend, but you didn't want anyone else to be able to read it. You might come up with a code where certain letters or symbols stand for different words or phrases.

In a similar way, when we write code in the programming language called C, we can use "escape sequences" to represent certain characters or actions that we don't want to directly display on the screen or in a file.

For instance, the backslash "\" is used to tell the computer that the next character has a special meaning. Here are some examples of escape sequences and what they mean:

- \n: This means "new line". When you see this in a string of text, it tells the computer to start a new line of text rather than continuing on the same line. So if you wanted to print out the words "Hello" and "world" on two separate lines, you could use the following code:

```
printf("Hello\nworld");
```

- \t: This means "tab". When you see this in a string of text, it tells the computer to insert a tab character (like when you press the "Tab" key on your keyboard). So if you wanted to print out some columns of data, you could use tabs between each field:

```
printf("Name\tAge\tFavorite Color\n");
printf("Alice\t27\tBlue\n");
printf("Bob\t42\tGreen\n");
```

- \": This means "double quote". When you want to include a double quote character in a string of text (like when you're printing out a message), you need to use an escape sequence so that the computer knows you're not ending the string early. Here's an example:

```
printf("She said, \"Hello!\" to me.");
```

- \$: This means "dollar sign". In C, a dollar sign is just an ordinary character, but in some other programming languages it has a special meaning. So if you wanted to include a dollar sign in a C string, you would need to use an escape sequence:

```
printf("The price is $5.00.");
```

There are many other escape sequences you can use in C, but hopefully this gives you some idea of what they are and how they work.