下列 C 語言程式的執行結果為何? #include<stdio.h> int b = 100; int A(int c) { int a = 10; return a + b + c; } int main() { int a = 30, b = 60; printf("output = %d\n", A(20)); return 0; }
Aoutput = 90
Boutput = 110
Coutput = 130正確答案
Doutput = 150
答案與詳解
正解:A() 中 a=10(區域)、b=100(全域,因 A 內未定義 b)、c=20(參數),總和 10+100+20=130。
