【學習筆記】【C語言】類型說明符,學習筆記c語言

來源:互聯網
上載者:User

【學習筆記】【C語言】類型說明符,學習筆記c語言
1. short和long

3.代碼

 

 1 #include <stdio.h> 2 /* 3  int 4個位元組  %d 4  short 2個位元組 %d 5  long 8個位元組  %ld 6  long long 8個位元組 %lld 7   8   9  signed10  unsigned  %u11  */12 int main()13 {14     // 0000 0000 0000 0000 0000 0000 0000 000015     // 2的31次方-116     // 2的32次方-117     int num;18     19     /*20      signed和unsigned的區別:21       signed 最高位要當做符號位22      unsigned 最高位不要當做符號位23     */24     // signed == signed int25     // signed 有符號:正數、0、負數26     signed int a = 10;27     signed a2 = 10;28     29     // unsigned int == unsigned30     // unsigned 無符號:0、正數31     unsigned int b = 10;32     unsigned b2 = 10;33     34     long unsigned int c = 34343;35     long unsigned c2 = 423432;36     37     short unsigned int d = 4343;38     short unsigned d2 = 43243;39     40     short signed int e = 54354;41     short signed e2 = 434;42     43     44     45     46     return 0;47 }48 49 void longAndShort()50 {51     // long == long int52     long int a = 100645654654645645l;53     long a2 = 100645654654645645l;54     55     // long long int == long long56     long long int c = 100645654654645645ll;57     long long c2 = 4535435435435ll;58     59     // short == short int60     short int d = 5454;61     short d2 = 43434;62     63     //printf("%lld\n", c);64     65     int s = sizeof(long long int);66     printf("%d\n", s);67 }

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.