c_cpp CPP-Datatypes_Size_and_Range

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp CPP-Datatypes_Size_and_Range相关的知识,希望对你有一定的参考价值。

#include <bits/stdc++.h>
using namespace std;

// #CPP_STL #IMP_NOTES
// https://stackoverflow.com/questions/1819189/what-range-of-values-can-integer-types-store-in-c

int main() {
	cout<<"int: 4 - "<<sizeof(int)<<endl;
	cout<<"float: 4 - "<<sizeof(float)<<endl;
	cout<<"long: 4 - "<<sizeof(long)<<endl;
	cout<<"long long: 8 - "<<sizeof(long long)<<endl;
	cout<<"long int: 4 - "<<sizeof(long int)<<endl;
	cout<<"long long int: 8 - "<<sizeof(long long int)<<endl;
	cout<<"double: 8 - "<<sizeof(double)<<endl;
	cout<<"char: 1 - "<<sizeof(char)<<endl;
	cout<<"bool: 1 - "<<sizeof(bool)<<endl;
	string x;
	cout<<"string x; sizeof(x): 24 - "<<sizeof(x)<<endl;
	return 0;
}

以上是关于c_cpp CPP-Datatypes_Size_and_Range的主要内容,如果未能解决你的问题,请参考以下文章

c_cpp -_-公元前

c_cpp uv__next_timeout.c

c_cpp uv__handle_unref.c

c_cpp uv__handle_ref.c

c_cpp uv__handle_stop.c

c_cpp uv__handle_start.c