程式語言兩題 - 考試
By Bethany
at 2013-07-27T22:43
at 2013-07-27T22:43
Table of Contents
1.已知陣列M[15][12],每個元素4bytes。M[5][5]位址=13244868,行為主儲存模式,
則M結束位置為...
我是算13244868+((11-5)*15+(14-5))*4=13245264
可是書本上說還要加3 所以不清楚加3的原因為何
2.#include <stdio.h>
#include <stdlib.h>
#include <string.h>
union grade{
char course[5];
int score;
}Bob;
void printBob(void){
printf("Bob科目=%s\n",Bob.course);
printf("Bob成績=%d\n",Bob.score);
}
int main(void){
Bob.score=98;
strcpy(Bob.course,"數學");
printBob();
strcpy(Bob.course,"數學");
Bob.score=98;
printBob();
system("PAUSE"); return 0;
}
output是Bob科目=數學
Bob成績=-943798596
Bob科目=b
Bob成績=98
那個-943798596和b是怎麼形成的不太清楚
還請會的大大賜教
--
則M結束位置為...
我是算13244868+((11-5)*15+(14-5))*4=13245264
可是書本上說還要加3 所以不清楚加3的原因為何
2.#include <stdio.h>
#include <stdlib.h>
#include <string.h>
union grade{
char course[5];
int score;
}Bob;
void printBob(void){
printf("Bob科目=%s\n",Bob.course);
printf("Bob成績=%d\n",Bob.score);
}
int main(void){
Bob.score=98;
strcpy(Bob.course,"數學");
printBob();
strcpy(Bob.course,"數學");
Bob.score=98;
printBob();
system("PAUSE"); return 0;
}
output是Bob科目=數學
Bob成績=-943798596
Bob科目=b
Bob成績=98
那個-943798596和b是怎麼形成的不太清楚
還請會的大大賜教
--
Tags:
考試
All Comments
By Regina
at 2013-07-31T09:00
at 2013-07-31T09:00
By Thomas
at 2013-08-03T15:13
at 2013-08-03T15:13
By Ursula
at 2013-08-08T07:27
at 2013-08-08T07:27
By Lily
at 2013-08-12T07:25
at 2013-08-12T07:25
By Dorothy
at 2013-08-12T22:29
at 2013-08-12T22:29
By Carolina Franco
at 2013-08-17T13:51
at 2013-08-17T13:51
By Rebecca
at 2013-08-22T09:05
at 2013-08-22T09:05
Related Posts
法學緒論 伊藤 程譯
By Franklin
at 2013-07-27T22:31
at 2013-07-27T22:31
短期內不會再參加任何研訊院舉辦的考試
By Hamiltion
at 2013-07-27T22:27
at 2013-07-27T22:27
郝語特報第七版
By Dorothy
at 2013-07-27T22:25
at 2013-07-27T22:25
科目的選擇
By Poppy
at 2013-07-27T22:11
at 2013-07-27T22:11
生物 英文 & 普化書籍
By Megan
at 2013-07-27T21:58
at 2013-07-27T21:58