C C + + various types of range of values

Source: Internet
Author: User

Variables of type int store values from 2147483648 to 2147483647

1 //Example2#include <iostream>3 2 using namespacestd;4 3 intMainvoid)5 4 {6 5 7 6cout<<"the value range for the int type is:"<<INT_MIN<<"to the"<<INT_MAX<<Endl;8 7     return 0;9 8}

unsigned variables of type int store values from 0 to 4294967295

1 //Example2#include <iostream>3 using namespacestd;4 intMainvoid)5 {6cout<<"the value range for the unsigned int type is: 0 to"<<UINT_MAX<<Endl;7     return 0;8}

Variables of type short store values from 32768 to 32767

Unsigned short types of variables store values from 0 to 65535


Variables of type char store values from 128 to 127
Unsigned variables of type char store values from 0 to 255


A long variable stores values from 2147483648 to 2147483647
Unsigned a long variable stores values from 0 to 4294967295
A long long variable stores values from 9223372036854775808 to 9223372036854775807
Unsigned a long long variable stores values from 0 to 18446744073709551615

The minimum value of a non-0 float type variable is 1.175e-038
The value of the maximum float type variable is 3.403e+038
The minimum value of a non-0 double type variable is 2.225e-308
The value of the maximum double type variable is 1.798e+308
The minimum value of a non-0 long double type variable is -0.000e+000
The maximum value of a long double type variable is -1. #QOe +000
Variable of type float provides 6-bit decimal digits of precision
A variable of type double provides the number of decimal digits of 15-bit precision
A variable of type long double provides 18-bit decimal digits of precision

1#include <stdio.h>2#include <limits.h>3#include <float.h>4#include <stdlib.h>5 intMainvoid)6 7 {8 9printf"variables of type char store values from%d to%d\n", Char_min, Char_max);Ten  Oneprintf"unsigned variables of type char store values from 0 to%u\n", Uchar_max); A  -printf"variables of type short store values from%d to%d\n", Shrt_min, Shrt_max); -  theprintf"unsigned short types of variables store values from 0 to%u\n", Ushrt_max); -  -printf"variables of type int store values from%d to%d\n", Int_min, Int_max); -  +printf"unsigned variables of type int store values from 0 to%u\n", Uint_max); -  +printf"variable of type long stores values from%ld to%ld\n", Long_min, Long_max); A  atprintf"unsigned a long variable stores values from 0 to%lu\n\n", Ulong_max); -  -printf"a long long variable stores values from%lld to%lld\n", Llong_min, Llong_max); -  -printf"unsigned a long long variable stores values from 0 to%llu\n", Ullong_max); -  inprintf"The minimum value of a non-0 float type variable is%.3e\n", flt_min); -  toprintf"The value of the largest float type variable is%.3e\n", Flt_max); +  -printf"The minimum value of a non-0 double type variable is%.3e\n", dbl_min); the  *printf"The maximum value of a double type variable is%.3e\n\n", Dbl_max); $ Panax Notoginsengprintf"The minimum value of a non-0 long double type variable is%.3le\n", ldbl_min); -  theprintf"The maximum value of a long double type variable is%.3le\n", Ldbl_max); +  Aprintf"variables of type float provide the number of decimal digits of the%u bit precision \ n", flt_dig); the  +printf"A variable of type double provides the number of decimal digits of the%u bit precision. \ n", dbl_dig); -  $printf"A variable of type long double provides the number of decimal digits of the%u bit precision \ n", ldbl_dig); $  -System"Pause"); -  the     return 0; -}

C C + + various types of range of values

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.