C++ Standard Library C++ STL Library

C++ <cwchar> - WCHAR_MAX Constant

The C++ <cwchar> WCHAR_MAX is a macro constant definition of type wchar_t that expands into the largest possible value of wchar_t.

This macro constant is also defined in header <cstdint>.


The example below shows the value of WCHAR_MAX macro constant.

#include <iostream>
#include <cwchar>
using namespace std;
int main (){
  //largest possible value of wchar_t
  cout<<"WCHAR_MAX = "<<WCHAR_MAX<<"\n";
  //smallest possible value of wchar_t
  cout<<"WCHAR_MIN = "<<WCHAR_MIN<<"\n";
  return 0;

The output of the above code will be:

WCHAR_MAX = 2147483647
WCHAR_MIN = -2147483648

❮ C++ <cwchar> Library