logo

Crowdly

Browser

Додати до Chrome

A  string literal  or  string constant  is a sequence of zero or more characters...

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

string literal or string constant is a sequence of zero or more characters enclosed in double quotes, as in "I am a string" or the empty string "".

The quotes are not part of the string, but serve only to delimit it. Other examples of string literals are:

"hello world"

"total expenditures: "

"C comments begin with \'/*\'.\n"

String literals can be concatenated at compile time. For example, the following two string literals:

"hello, " "world"

are equivalent to the string literal

"hello, world"

Technically, a string literal is an array of characters with the internal representation having a null character '\0' at the end. This means that the physical storage required for a string literal is one more than the number of characters written before the quotes. This also means that a string literal containing a single character is not the same as a character constant. The string literal "a" is an array of  char elements with the first char element having value 'a' and the second char element having null character '\0'. On the other hand, character constant 'a' has an integral value [in the ASCII character set] and is of type int.

Since a string literal is an array of characters, we can use the subscript operator to access individual characters in the array, as in expression "representation"[2] which evaluates to value 'p' of type char.

Now, write the exact value resulting from the evaluation of expression sizeof("representation").

Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на distance3.sg.digipen.edu?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome