Home » C++ programming language

SCHAR_MIN constant with example in C++

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

C++ SCHAR_MIN macro constant

SCHAR_MIN constant is a macro constant which is defied in climits header, it is used to get the minimum value of a signed char object, it returns the minimum value that a signed char object can store, which is -128.

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

Syntax of SCHAR_MIN constant:

    SCHAR_MIN

Example:

    Constant call:
    cout << SCHAR_MIN;

    Output:
    -128

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

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

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

Output

SCHAR_MIN: -128

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

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

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

Output

SCHAR_MIN: -128
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT


Top MCQs

Comments and Discussions!




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.