C資料類型之基本類型

來源:互聯網
上載者:User

標籤:c基礎資料型別 (Elementary Data Type)

先來張C資料類型的圖片,如

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/45/D1/wKiom1PsFlbz4ROYAADPAyT_cBQ963.jpg" title="c資料類型.png" alt="wKiom1PsFlbz4ROYAADPAyT_cBQ963.jpg" />

基礎資料型別 (Elementary Data Type)的長度,資料存放區是以"位元組"(Byte)為單位,資料轉送是以"位"(bit)為單位,一位就代表一個0或1(二進位),一個位元組(Byte)佔8位(bit).

#import <Foundation/Foundation.h>int main(int argc, const char * argv[]){    @autoreleasepool {        short int shortIntType = 1;        int intType = 2;        long longType = 3L;        float floatType = 4.1f;        double doubleType = 5;        char charType = ‘A‘;                printf("size of short it is %lu Byte\n",sizeof(shortIntType));        printf("size of int is %lu Byte\n",sizeof(intType));        printf("size of long is %lu Byte\n",sizeof(longType));        printf("size of float is %lu Byte\n",sizeof(floatType));        printf("size of double is %lu Byte\n",sizeof(doubleType));        printf("size of char is %lu Byte\n",sizeof(charType));    }    return 0;}

輸出結果如:

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/45/D3/wKioL1PsHariJP-nAACZhpcU_3k250.jpg" title="長度.png" alt="wKioL1PsHariJP-nAACZhpcU_3k250.jpg" />

本文出自 “7803002” 部落格,請務必保留此出處http://7813002.blog.51cto.com/7803002/1539769

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.