This code compiles (and doesn't generate warnings with -Wall), but the output is:Code:#include <iostream> using namespace std; #include <limits> int main() { cout << "smallest char ==" << numeric_limits<char>::min() << '\n' << "largest char ==" << numeric_limits<char>::max() << '\n' << "smallest short ==" << numeric_limits<short>::min() << '\n' << "largest short ==" << numeric_limits<short>::max() << '\n'; }
The point of this exercise is to print out the implementation-specific lower and upper bounds of each (primitive) type. What's going on with `char'?Code:smallest char == largest char = smallest short ==-32768 largest short ==32767



LinkBack URL
About LinkBacks




CornedBee