• 各种数据类型占用内存大小,以及字、字节、位


    前言

    字也叫Word 字节也叫Byte 位也叫bit
    1个字=2个字节
    1个字节=8位
    1K=1024B
    1M=1024K
    1G=1024M
    1T=1024G

    16位编译器
    char :1个字节
    char*(即指针变量): 2个字节
    short int : 2个字节
    int:  2个字节
    unsigned int : 2个字节
    float:  4个字节
    double:   8个字节
    long:   4个字节
    long long:  8个字节
    unsigned long:  4个字节
     
    32位编译器
    char :1个字节
    char*(即指针变量): 4个字节(32位的寻址空间是2^32, 即32个bit,也就是4个字节。同理64位编译器)
    short int : 2个字节int:  4个字节
    unsigned int : 4个字节
    float:  4个字节
    double:   8个字节
    long:   4个字节
    long long:  8个字节
    unsigned long:  4个字节

    64位编译器
    char :1个字节
    char*(即指针变量): 8个字节
    short int : 2个字节
    int:  4个字节
    unsigned int : 4个字节
    float:  4个字节
    double:   8个字节
    long:   8个字节
    long long:  8个字节
    unsigned long:  8个字节各种数据类型

  • 相关阅读:
    table表格
    常见页面布局方式(三种框架集)
    学习标签属性3
    学习标签属性2
    学习标签属性1
    Purity in My Programming: Functions in Go
    cron一有趣处
    go函数作为一等民
    LRU算法
    go中的一个网络重连复用
  • 原文地址:https://www.cnblogs.com/jueshi0208/p/5830809.html
Copyright © 2020-2023  润新知