Saturday, May 22, 2010

String and Character Constants

String and character constants are very different. Strings are surrounded by double quotes (") and
characters by single quotes ('). So "X" is a one-character string, while 'Y' is just a single character.

The string "X" takes up two bytes, one for the X and one for the end-of-string (\0). The character 'Y' takes up one byte.

No comments:

Post a Comment