Escalas em CPP
// #include <climits>
{
int Year = 2022;
char tech = 'y';
bool BiggerThan32 = 't';
float AvaRageGrade = 4.5;
double balance = 13425346576876;
cout << "Size of int is "<<sizeof(int) <<"bytes\n";
cout << "int max value is "<< INT_MAX << endl;
cout << "int min value is " << INT_MIN << endl;
cout << "size of unsigned int "<<sizeof(unsigned int) <<"bytes\n";
cout << "Uint max value is " << UINT_MAX << endl;
cout << "Size of bool is "<< sizeof(bool) <<"bytes\n";
cout << "Size of char is " << sizeof(char) <<"bytes\n";
cout << "size of float is " << sizeof(float)<<"bytes\n";
cout <<"size of double is"<<sizeof(double)<< "bytes\n";
return 0;
}
//RESULT
// Size of int is 4bytes
// int max value is 2147483647
// int min value is-2147483648 (the 1 bit difference from the max value is coming because of the 0 as it's counted as well.)
// size of unsigned int4bytes
// Uint max value is 4294967295
// Size of bool is 1bytes
// Size of char is 1bytes
// size of float is 4bytes
// size of double is8bytes
// OTHER USES
// CHAR_MIN:- Minimum value for an object of type char. Value of CHAR_MIN is either -127 (-27+1) or less or 0.
// CHAR_MAX:- Minimum value for an object of type char. Value of CHAR_MIN is either -127 (-27+1) or less or 0.
// SHRT_MIN:- Minimum value for an object of type short int. Value of SHRT_MIN is -32767 (-215+1) or less.
// SHRT_MAX:- Maximum value for an object of type short int. Value of SHRT_MAX is 32767 (215-1) or greater.
// USHRT_MAX:- Maximum value for an object of type unsigned short int. Value of USHRT_MAX is 65535 (216-1) or greater.
// INT_MIN:- Minimum value for an object of type int. Value of INT_MIN is -32767 (-215+1) or less.
// INT_MAX:- Maximum value for an object of type int. Value of INT_MAX is 32767 (215-1) or greater.
// UINT_MAX:- Maximum value for an object of type unsigned int. Value of UINT_MAX is 65535 (216-1) or greater.
// LONG_MIN:- Minimum value for an object of type long int. Value of LONG_MIN is -2147483647 (-231+1) or less.
// LONG_MAX:- Maximum value for an object of type long int. Value of LONG_MAX is 2147483647 (231-1) or greater.
// ULONG_MAX:- Maximum value for an object of type unsigned long int. Value of ULONG_MAX is 4294967295 (232-1) or greater.
// LLONG_MIN:- Minimum value for an object of type long long int. Value of LLONG_MIN is -9223372036854775807 (-263+1) or less.
// LLONG_MAX:- Maximum value for an object of type long long int. Value of LLONG_MAX is 9223372036854775807 (263-1) or greater.
// ULLONG_MAX:- Maximum value for an object of type unsigned long long int. Value of ULLONG_MAX is 18446744073709551615 (264-1) or greater.
Tame Tortoise