計算機概論、大意(資訊科學概論,電腦常識,電子計算機概論)題庫下載題庫

上一題

23 下列 C 程式執行後的結果為何? 5d2d7713afc48.jpg
(A) string1 and string2 are the same string1 and string3 are the same
(B) string1 and string2 are the same string1 and string3 are different
(C) string1 and string2 are different string1 and string3 are the same
(D) string1 and string2 are different string1 and string3 are different



答案:登入後觀看
難度: 困難
最佳解!
power80230 國三下 (2019/07/17)
s1==s2 這裡的s1指的是s1這個c☆☆☆ ...


(內容隱藏中)
查看隱藏文字
2F
kkkklaaa 國二下 (2021/11/26)

還是不懂

3F
蔡明勳 高三上 (2022/09/19)
字串比較用 strcmp 或 strncmp
4F
hhh 大一上 (2023/04/15)

s1和s2都是字符陣列,它們都包含字元序列"abc"。然而,s1和s2是不同的陣列,它們在記憶體中佔用不同的位置。因此,使用==運算符比較s1和s2的值時,會比較它們的記憶體地址而不是它們所包含的字元序列。因此,這段程式碼的結果是不確定的,因為s1和s2的記憶體位置可能不同。如果要比較兩個字元陣列的值,可以使用strcmp()函數來進行字元序列的比較

23 下列 C 程式執行後的結果為何?(A) string1 and strin..-阿摩線上測驗