You seem to be referring to string constants. And distinguishing them from symbolic constants.
A char
is one byte on all architectures. The character constant uses the single quote delimiter '
.
A string is a continuous sequence of characters with a trailing NUL character to identify the end of a string. The string uses double quotation marks "".
In addition, you introduce the syntax for expressing the constant of a string C, which uses a black mark to indicate special characters. \n
is one character in a string constant.
So, for the examples 'n', "n", '\n', "\n"
:
'n'
is one character
"n"
is a string with one character, but it takes two characters of memory (one for the letter n
and one for NUL
'\n'
- one character, new line (ctrl-J for ASCII based systems)
"\n"
is one character plus NUL.
I leave the rest to puzzles based on these.
source share