dijter
0
Q:

wide-character literal

Wide char is similar to char data type, except that wide char take up twice the space and can take on much larger values as a result. char can take 256 values which corresponds to entries in the ASCII table. On the other hand, wide char can take on 65536 values which corresponds to UNICODE values which is a recent international standard which allows for the encoding of characters for virtually all languages and commonly used symbols.

Just like the type for character constants is char, the type for wide character is wchar_t.
This data type occupies 2 or 4 bytes depending on the compiler being used.
Mostly the wchar_t datatype is used when international languages like Japanese are used.
Below is a simple C++ implementation to show how wchar_t is used :

filter_none
edit
play_arrow

brightness_4
// An example C++ program to demonstrate use of wchar_t 
#include <iostream> 
using namespace std; 
  
int main() 
{ 
    wchar_t w  = L'A'; 
    cout << "Wide character value:: " << w << endl ; 
    cout << "Size of the wide char is:: " << sizeof(w); 
    return 0; 
} 
0

New to Communities?

Join the community