Re: [問題] long v.s long long int

看板C_and_CPP作者 ( )時間14年前 (2011/06/10 04:39), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串4/4 (看更多)
http://www.unix.org/version2/whatsnew/lp64_wp.html 關鍵的表格: Datatype LP64 ILP64 LLP64 ILP32 LP32 char 8 8 8 8 8 short 16 16 16 16 16 _int32 32 int 32 64 32 32 16 long 64 64 32 32 32 long long 64 pointer 64 64 64 32 32 Win 32bit, Linux 32bit 都是用 ILP32 的 data model Win 64bit 據說是 LLP 64, Linux 64bit 是 LP64 ※ 引述《singlovesong (~"~)》之銘言: : 開發平台(Platform): (Ex: VC++, GCC, Linux, ...) : linux gcc : 問題(Question): : long 跟 long long int 的差別 : 請問一下 : 我用的是linux 64bit : 在網路上看到很多網站都說 long 是4個bytes 而 long long int 是8個 : 但是我自己用sizeof 印的時候 兩個都跑出8欸@@ : 請問一下這是因為我用的是64bit 的機器嗎? 還是說是網站上寫錯了? : long 跟 int 跟 long long int 三個的關係是...?? : ---------------- : 附上code: : #include <stdio.h> : int main(){ : printf("size of long is %d \n",sizeof(long)); : printf("size of long long int is %d \n",sizeof(long long int)); : printf("size of long int is %d \n",sizeof(long int )); : return 0; : } : output: 都是 8 : 謝謝!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.217.33.231

06/10 12:39, , 1F
噢 OP 了 不好意思><
06/10 12:39, 1F
文章代碼(AID): #1DyP_lam (C_and_CPP)
討論串 (同標題文章)
文章代碼(AID): #1DyP_lam (C_and_CPP)