# C語言題庫-006 請問以下代碼有什麼問題: ``` char* s=“AAA”; printf(“%s”,s); s[0]=‘B’; printf(“%s”,s); ``` 有什麼錯? 【標準答案】“AAA” 是字符串常量。s是指針,指向這個 字符串常量,所以聲明s的時候就有問題。 cosnt char* s=“AAA”; 然後又因爲是常量,所以對是s[0] 的賦值操作是不合法 的。
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up