Jump to content
  • Advertisement
Sign in to follow this  

Chars literals?

This topic is 4237 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How do you call the literals that symbol chars in CPP. Such as '\n' Also, what is the char who its numeric value is 9? I have a .c file and I encountered a char with a numeric value of 9. Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
The \n itself (or \0, \t etc.) is called an "escape sequence".

The code construct {single quote} {specification of one character: either an escape sequence of some sort, or an actual single character} {single quote} is a "character literal".

ASCII character 9 is a tab. For reference. However, it's poor style to specify the character that way if it's intended to be interpreted as text; a 'char' value of 9 (as opposed to '\t') should indicate a *byte* value of 9, i.e. the numeric quantity 9, stored in one byte.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!