Home » C++ programming language

UINT_MAX constant with example in C++

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

C++ UINT_MAX macro constant

UINT_MAX constant is a macro constant which is defied in climits header, it is used to get the minimum value of an unsigned int object, it returns the minimum value that an unsigned int object can store, which is 4294967295 (on 32 bits compiler).

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 UINT_MAX constant is defined in both of the libraries.

Syntax of UINT_MAX constant:

    UINT_MAX

Example:

    Constant call:
    cout << UINT_MAX;

    Output:
    4294967295

C++ code to demonstrate example of UINT_MAX constant with climits header

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

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

Output

UINT_MAX: 4294967295

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

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

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

Output

UINT_MAX: 4294967295





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.