#477 – Full List of Escape Sequences for Character Literals

You can use one of several escape sequences within a character literal to represent a character that you can’t include directly in the literal.

The full list of character literals includes:

  • \’ – Single quote (U+0027)
  • \” – Double quote (U+0022)
  • \\ – Backslash (U+005C)
  • \a – Alert (U+0007)
  • \b – Backspace (U+0008)
  • \f – Form feed (U+000c)
  • \n – New line (U+000A)
  • \r – Carriage return (U+000D)
  • \t – Horizontal tab (U+0009)
  • \v – Vertical tab (U+000B)
            char single = '\'';
            char dquote = '\"';
            char backslash = '\\';
            char alert = '\a';
            char backspace = '\b';
            char formFeed = '\f';
            char newLine = '\n';
            char cr = '\r';
            char horizTab = '\t';
            char vertTab = '\v';

You can also use a backspace followed by 0 to indicate a null character.

            char nullChar = '\0';
Advertisements

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: