From the course: C Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Specifying characters and strings

Specifying characters and strings - C Tutorial

From the course: C Essential Training

Start my 1-month free trial

Specifying characters and strings

- [Instructor] To declare a single character literal in your code, sit the character between a pair of single quotes as shown here. For untypable values, like Enter or Tab, use an escape sequence. These characters, and yes, they're interpreted as a single character, start with a backslash and then some type of character code. You can also escape specific values as a single character, such as hexadecimal value 41, which is shown as \X41. Though multiple characters are used in these expressions, the escape sequence remains a single character value. This list shows common escape sequences for single characters. The new line is the one you see most often, which inserts the Enter key press into a string, or it can be used as a single character. If you want to specify a single quote character, you can use the backslash single quote within single quotes and string literals with double quotes inside must have the internal…

Contents