zoukankan      html  css  js  c++  java
  • 32位电脑“内置类型"所占空间大小

    <pre name="code" class="cpp">#include  <iostream>
    using std::cout;	using std::cin; using std::endl;
    
    #include <string>
    using std::string;	
    #include <cstring>
    #include <vector>
    using std::vector;
    
    #include <iterator>
    using std::begin; using std::end;
    
    #include <cstddef>
    using std::size_t; 
    
    
    int main()
    {
    	int ia;
    	cout << "the bytes of int is " << sizeof ia << endl;
    	short sa;
    	cout << "the bytes of short is " << sizeof sa << endl;
    	long  la;
    	cout << "the bytes of long is " << sizeof la << endl;
    	long long lla;
    	cout << "the bytes of long long is " << sizeof lla << endl;
    	float fa;
    	cout << "the bytes of float is " << sizeof fa << endl;
    	double da;
    	cout << "the bytes of double is " << sizeof da << endl;
    	long double lda;
    	cout << "the bytes of long double is " << sizeof lda << endl;
    	return 0;
    	
    }


    
    

    输出

    the bytes of int is 4
    the bytes of short is 2
    the bytes of long is 4
    the bytes of long long is 8
    the bytes of float is 4
    the bytes of double is 8
    the bytes of long double is 12


  • 相关阅读:
    [hdu5312]数的拆分,数学推导
    [POJ1038]状压DP
    [hdu2112]最短路
    [hdu1532]最大流
    [hdu5256]LIS模型
    [hdu5255]枚举
    [hdu5254]BFS
    [hdu5270]按位统计,容斥,归并
    Elasticsearch在Centos 7上的安装与配置
    手动安装java1.8
  • 原文地址:https://www.cnblogs.com/vczf/p/6823264.html
Copyright © 2011-2022 走看看