What is the difference between the constants 7, '7', and "7"?

  • 0 replies
  • 225 views
*

Offline mechanic

  • Engineer
  • *****
  • 3307
  • Gender: Male
  • Engineer
    • View Profile
    • Engineering Forum
What is the difference between the constants 7, '7', and "7"?

Answer:

The constant 7 is the integer 7 (the number you get when you add 3 and 4). The constant '7' is a character constant consisting of the character `7' (the key between `6' and `8' on the keyboard, which also has a `&' on it on mine). The constant "7" is a string constant consisting of one character, the character `7'.