Facebook Page Twitter Page LinkedIn Page
× C Standard Library


The wchar_t is an implementation-defined wide character type. It represent distinct codes for all members of the wide character set specified among the supported locales.

In C++, wchar_t is a distinct fundamental type and thus it is not defined in <cwchar> nor in any other header. In C, this is a typedef of an integer type.

Example:

The below example shows the usage of wchar_t type.

#include <stdio.h>
#include <wchar.h>
 
int main (){
  //initiating a variable str of 
  //wchar_t type
  wchar_t str[256] = L"Hello World!.";

  printf("str contains: %ls", str);
  return 0;
}

The output of the above code will be:

str contains: Hello World!.

❮ C <wchar.h> Library