The string constant the consists of 5 exclamation marks will be “!!!!!”. It occupies the two bytes.
What is a string constant?
String constant is also known as string literals. String constants are special types of constant that can store a fixed sequence of characters. A string constant can be any sequence of characters that can be enclosed in double-quotes.
Following is an example of a string constant;
“This is a string”
What is a Null string?
A null string or empty string is written as “”. A literal string is stored internally as a given sequence of characters plus the final null characters. A null string is stored as a single null character.
The characters inside the double quotes can include escape sequence like;
It will print as;
“Name” \ Address
The Name is preceded by two tabs. The Address is preceded by one tab. The line id followed by two new lines. The |” provide interior double-quotes. The escape character sequence \\ is translated into \ by the compiler.
Adjacent string literals:
These can be separated only by whitespaces and are concatenated during the parsing phase.
“This is “ “just”
“ an example.”
Is equivalent to the following.
“This is just an example.”