c語言裡的0L是什麼意思?

2009-07-09 4:39 pm
c語言裡的0L是什麼意思?
例如
if (ifp->ipaddr != 0L)
{
....
}
是指0嗎?
更新1:

如果寫if (ifp->ipaddr != 0) 這樣會有問題嗎?

回答 (5)

2009-07-10 6:55 am
✔ 最佳答案
就是
long int 0
你的程式可能是在比對 ETHNET的封包內容的IP ADDRRESS
所以IPADDR的宣告應該也是 Long int
2009-07-09 8:27 pm
Do this & you will find the answers all by yourself:

printf("sizeof(0L) is %d", sizeof(0L));

if you run 64bit OS on 64bit processors, you may get an answer of 8 octects.The only suggestions given by K&R is - long is not shorter than int while int is not shorter than short.
2009-07-09 5:44 pm
就是0 只是這個0是long型態的
2009-07-09 4:59 pm
我來翻譯一下bean_boom_2大的回答:
0L在C語言是以長整數(至少32位元容量)儲存(表示)的0。依照版主所貼的程式碼,似乎是表示一個ip位址,那麼應該就是32位元。
2009-07-09 4:43 pm
0L in C means zero in long (32 bit at least). It seems the code you have posted is for an IP address and thus it should be 32 bit.


收錄日期: 2021-04-30 13:00:50
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20090709000015KK01990

檢視 Wayback Machine 備份