शीर्षलेख फ़ाइलें "limits.h" C भाषा में मौजूद हैं जबकि
“limits.h” या
CHAR_BIT | LONG_MIN | LONG_MAX | CHAR_MIN | CHAR_MAX |
INT_MIN | INT_MAX | SHRT_MIN | SHRT_MAX | ULONG_MAX |
यहाँ C++ भाषा में
उदाहरण
#include<iostream> #include <bits/stdc++.h> #include<climits> using namespace std; int main() { int x = 28; int a = CHAR_BIT*sizeof(x); stack<bool> s; cout << "The number is : " << x << endl; for (int i=1; i<=a; i++) { s.push(x%2); x = x/2; } cout << "The number of bits in a byte : " << CHAR_BIT << endl; for (int i=1; i<=a; i++) { cout << s.top(); s.pop(); if (i % CHAR_BIT == 0) cout << " "; } cout << "\n\nThe minimum value of short int :" << SHRT_MIN; return 0; }
आउटपुट
The number is : 28 The number of bits in a byte : 8 00000000 00000000 00000000 00011100 The minimum value of short int :-32768
उपरोक्त कार्यक्रम में,
int x = 28; int a = CHAR_BIT*sizeof(x); …. cout << "\n\nThe minimum value of short int :" << SHRT_MIN;