×

C++ Tutorial

C++ Data types

C++ Operators & Keywords

C++ Conditional Statements

C++ Functions

C++ 'this' Pointer, References

C++ Class & Objects

C++ Constructors & Destructors

C++ Operator overloading

C++ 11 (Advance C++)

C++ Preparation

C++ Header Files & Functionsr

Data Structure with C++

C++ - Miscellaneous

C++ Programs

MB_LEN_MAX constant with example in C++

C++ MB_LEN_MAX constant: Here, we are going to learn about the MB_LEN_MAX macro constant of climits header in C++.
Submitted by IncludeHelp, on May 01, 2019

C++ MB_LEN_MAX macro constant

MB_LEN_MAX constant is a macro constant which is defied in climits header, it is used to get the maximum number of bytes in a multibyte character, for any locale, it returns maximum number of bytes that a multibyte character, which is 1 or more than it.

Note:

  • The actual value depends on the compiler architecture or library implementation.
  • We can also use <limits.h> header file instead of <climits> header as MB_LEN_MAX constant is defined in both of the libraries.

Syntax

Syntax of MB_LEN_MAX constant:

MB_LEN_MAX

Sample Input and Output

Constant call:
cout << MB_LEN_MAX;

Output:
16

Example 1

C++ code to demonstrate example of MB_LEN_MAX constant with climits header:

// C++ code to demonstrate example of 
// MB_LEN_MAX constant with climits header
#include<iostream>
#include<climits>
using namespace std;

int main()
{
   //prinitng the value of MB_LEN_MAX
    cout<<"MB_LEN_MAX: "<<MB_LEN_MAX<<endl;
    return 0;
}

Output

MB_LEN_MAX: 16

Example 2

C++ code to demonstrate example of MB_LEN_MAX constant with limits.h header file:

// C++ code to demonstrate example of 
// MB_LEN_MAX constant with <limits.h> header file
#include<iostream>
#include<limits.h>
using namespace std;

int main()
{
   //prinitng the value of MB_LEN_MAX
    cout<<"MB_LEN_MAX: "<<MB_LEN_MAX<<endl;
    return 0;
}

Output

MB_LEN_MAX: 16


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.