[問題] 我想請問下列幾提問題請高手指導!

看板C_and_CPP作者 (3!2!1!...)時間16年前 (2010/01/08 21:35), 編輯推噓1(103)
留言4則, 3人參與, 最新討論串1/1
我想請問幾個問題 (1) If an array has been declared this way: #define MAX 5 int prices[MAX]; What’s wrong in the following statements ? for (j=0; j<=MAX; j++) prices[j] = 3; A:因為MAX設定為5所以矩陣為1*5的矩陣,其中迴圈寫法for (j=0; j<=MAX; j++)矩陣 會變成1*6的矩陣錯,要把j<=MAX改為j<MAX才正確。 (2) int vox = 4; int *invox = &vox; Which of the following expression is true? 可複選 a. if (vox == &invox) b. if (vox == *invox) c. if (invox == *vox) d. if (invox ==&vox) 這提指標就不太會了,請高手說明指導謝謝! (3) Execution of the following function may cause the system crash. What statement must be added to the following statements to make it functions correctly ? main() { int j, *ptr2j; //ptr2j will be a pointer to j ********** 這行程式要怎們加 what statement shall be added? *ptr2j = 3; } 指標我真的不太會了,請高手說明指導謝謝! (4) What does the expression (0xF0 | 0x32) evaluate to ? a. 0x32 b. 0xF0 c. 0xF2 d. 0x00 A: 為 OR閘 答案C (5) unsigned int num = 0xF000; what does (num >>8) evaluate to ? a. 0x000f b. 0x00f0 c. 0xff00 d. 0xfff0 A:往右搬8位元 答案為b 謝謝各位撥空回答 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.121.136.124 ※ 編輯: tintin7322 來自: 140.121.136.124 (01/08 21:36)

01/08 21:41, , 1F
今天好像看LAB的某人也在寫這張...
01/08 21:41, 1F

01/08 21:42, , 2F
找一下取值運算子* 跟 取址運算子&
01/08 21:42, 2F

01/08 21:44, , 3F
3. ptr2j=&j;
01/08 21:44, 3F

01/08 21:45, , 4F
2. b d
01/08 21:45, 4F
文章代碼(AID): #1BHpIvbO (C_and_CPP)