Join Dan Gookin for an in-depth discussion in this video Working with escape characters in printf, part of Up and Running with C.
- View Offline
- Exercise Files
- Some characters you just can't…put into a string!…To sneak around this limitation,…you use Escape Characters.…In the C language,…a string is a bunch of characters…held between two double-quotes.…Everything between the double-quotes counts.…But, sometimes you can't type a character…such as the Enter key.…For example if you wanted to put…the Enter key press here…and create a new line of text,…the result would be two lines in the editor,…not the output.…The solution is to use the \n character in the string.…
It's an Escape Character,…which means it starts with a backslash…that's followed by n for newline.…Together the \n is interpreted…as one character, a newline,…and it's generated when the string is output.…The C language uses about…a dozen Escape Characters,…also known as Escape Sequences.…The most common are:…newline, tab, single quote,…double quote and if you really need…to display a backslash character,…you must Escape it as well.…
- Understanding a C program
- Adding comments
- Using escape characters
- Working with values and placeholders
- Introducing variables
- Making a decision with if
- Adding functions
- Manipulating strings
- Building arrays
- Nesting structures
Skill Level Beginner
1. Getting Started
2. Programming Basics
3. Program Flow Control
4. Intermediate C Language Concepts
5. Advanced C Language Concepts
Next steps2m 11s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.