看板 Grad-ProbAsk 關於我們 聯絡資訊
各位好 題目如下 A 64-bit word in memory stores 64 bit of 0's. What could this word be? (a) A NULL pointer (b) A part of a C character string (c) Two MIPS NOP instructions (d) A double precision FP value +0.0 答案是a.c.d 我想問的是為何b不行呢? 是因為C的string有長度限制嗎? 因為沒寫過C實在不清楚 希望知道的大大回答一下 感謝! -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.60.217.209 ※ 文章網址: https://www.ptt.cc/bbs/Grad-ProbAsk/M.1446467107.A.26C.html ※ 編輯: goldflower (61.60.217.209), 11/02/2015 20:27:06
antiquerefer: 我猜是因為char通常是1byte string結尾是'\0' 11/02 20:56
antiquerefer: 這樣可能是1字串+7個空字串 不知道這樣對不對 11/02 20:57
goldflower: 也就是string實際上不能夠存滿32bit且原本此資料結構 11/02 21:17
goldflower: 也不能到64bit這樣嗎? 11/02 21:18
antiquerefer: Strings are actually one-dimensional array of 11/02 21:33
antiquerefer: characters terminated by a null character '\0'. 11/02 21:33
antiquerefer: 長度無限制 主要看結尾 11/02 21:34
goldflower: 這樣我瞭解了~! 感謝 11/02 21:39