Examly題庫立即開始練習
國中教甄|資訊科技資訊科技112 年第 43 題單選題

What is the output result of the following program? #include <stdio.h> void fB(int\* p, int t) { int y = 4; t = 3 + y; \*p = y \* t; } main() { int x = 2, y = 1; fB(&y, x); printf("%4d%4d\n", x, y); }

A1 2
B35 7
C2 28正確答案
D1 35
答案與詳解
C
正確答案
本題考查 C 語言中傳值呼叫與傳址呼叫的差異,以及區域變數的作用域。

為什麼答案是 C

x 採傳值呼叫維持原值 2,y 採傳址呼叫被修改為 28,輸出結果符合。

載入中…

資訊科技 相關題目

想練更多資訊科技考古題?

Examly 收錄 38 萬+ 道歷屆題目,每題都有像這樣的精選詳解。免費下載,立即開練。

黑皮