Home c++ What is the `wchar_t` type for?

What is the `wchar_t` type for?

Author

Date

Category

What is the wchar_t data type for?


Answer 1, authority 100%

In simple terms, this type is used to represent extended character set values ​​that correspond to national languages.

The C++ standard currently supports the following types for representing characters to character sets, including extended sets such as characters
UNICODE:

char, char16_t, char32_t, wchar_t

An example of using a “wide” string literal

# include & lt; iostream & gt;
int main ()
{
  const wchar_t * s = L "Hello, World!";
  std :: wcout & lt; & lt; s & lt; & lt; std :: endl;
}

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions