Machine-translated by Google. Questions are authored in English.
Top

Discussion

How to declare a wide character in the string literal?

  • A.L prefix
  • B.l prefix
  • C.W prefix
  • D.Z prefix

Answer: A

Correct answer: L prefix

A wide string literal is written with an L prefix - L"text" - which gives an array of wchar_t rather than of char. The same prefix on a character constant, L'x', gives a wide character.

Later standards added further prefixes for specific encodings: u8 for UTF-8, u for char16_t and U for char32_t. The lower-case l is not a valid prefix, prefixes in C being case-sensitive.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.