Examly題庫立即開始練習
2 類科共用卷
普考-電信工程普考-電子工程
計算機概要10823單選題

下列 C 程式執行後的結果為何? char s1[10]="abc",s2[10]="abc",s3[10]="def"; if (s1==s2) printf("string1 and string2 are the same\n"); else printf("string1 and string2 are different\n"); if (s1==s3) printf("string1 and string3 are the same"); else printf("string1 and string3 are different");

Astring1 and string2 are the same string1 and string3 are the same
Bstring1 and string2 are the same string1 and string3 are different
Cstring1 and string2 are different string1 and string3 are the same
Dstring1 and string2 are different string1 and string3 are different正確答案
答案與詳解
D
正確答案
陣列名稱比較的是位址,s1、s2、s3 是三個不同陣列,位址必不相同,故兩次比較皆為 different。

為什麼答案是 D

正確。三個陣列位址互異,兩次 == 比較皆為 false,皆輸出 different。

載入中…

計算機概要 相關題目

想練更多計算機概要考古題?

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

Download on theApp Store即將推出Google Play
黑皮