Display Range of All Data Types
C++
Easy
8 views
Problem Description
Show the minimum and maximum values that different data types can store. This helps understand memory allocation and limits.
Logic: Use sizeof and limit constants to display ranges
Official Solution
void question1_datatype_ranges() {
cout << "int size: " << sizeof(int) << " bytesn";
cout << "char size: " << sizeof(char) << " bytesn";
cout << "float size: " << sizeof(float) << " bytesn";
cout << "double size: " << sizeof(double) << " bytesn";
cout << "bool size: " << sizeof(bool) << " bytesn";
cout << "long size: " << sizeof(long) << " bytesn";
}
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!