一般的程序錯誤,粗略一點(diǎn)分的話(huà),可以大致分為語(yǔ)法錯誤和語(yǔ)義錯誤。
語(yǔ)法錯誤可以看作是編碼出現了違反C語(yǔ)言規則的錯誤,一般編譯或者鏈接時(shí),
都會(huì )報錯的。
而語(yǔ)義錯誤,也可以叫做邏輯錯誤,
也就是說(shuō)你的代碼完全符合C語(yǔ)言的規范,不會(huì )出現編譯/鏈接的錯誤,
但是,在邏輯上有錯誤。
舉個(gè)簡(jiǎn)單的例子,
加入編一個(gè)代碼來(lái)統計int數組a的成員總和,成員總數為N:
for(int i=0;i<N;i++;) //這里在i++后面多了一個(gè)分號,這是語(yǔ)法錯誤
sum=sum+a[i];
for(int i=0;i<=N;i++) //這里多了一個(gè)i=N的取值,這是語(yǔ)義錯誤
sum=sum+a[i];
語(yǔ)言學(xué)范疇里的語(yǔ)義是指語(yǔ)用意義
語(yǔ)用意義是指話(huà)語(yǔ)在語(yǔ)言意義的基礎上由于語(yǔ)言使用者及語(yǔ)境的作用而產(chǎn)生的意義.
所謂語(yǔ)義錯誤通俗點(diǎn)說(shuō)就是語(yǔ)言使用者在一定的語(yǔ)境中對語(yǔ)言的使用出現了錯誤
http錯誤包括很多種404是找不到網(wǎng)頁(yè)403是沒(méi)有權限瀏覽網(wǎng)頁(yè),很多,你的是啥
getting along with my roommates
I have three days before the shool starts, because I wanted to wait for my roommates, take the initiative to understand them. I know that come late, can only be a passive object. I believe my college roommates will be my helper later in life. So to them, I would be very friendly, very patient, very warm. When I really konw all of them, I found in fact they are very cute, in spite of some bad habits.
A is the first roommate i know, he studied hard, learned all the time even if after lights-out, and loved to play basketball. But he is a little superstitious, for which I also had quarrel with him. However, when I heard he also conducted a study Buddhism, I only said he was lovable. When he told me that some strange things, I learned to accept in silence, even though my heart do not agree. I think this might be the best way.
b is the most squalid of people in our dormitory, he often did not feet, hair a mess, and the morning often asleep. For him, we all try to help, after all, he was the first independent living, and we helped him carry water, wake him up.
c temper is not very good, and we try not to offend him speak. Even if he told us a few words, We have also just smiled only.But he is the favorite among us to help people.
My roommate is actually very cute, they have their own view of the world, and they understand about tolerance.This is very fortunate!
聲明:本網(wǎng)站尊重并保護知識產(chǎn)權,根據《信息網(wǎng)絡(luò )傳播權保護條例》,如果我們轉載的作品侵犯了您的權利,請在一個(gè)月內通知我們,我們會(huì )及時(shí)刪除。
蜀ICP備2020033479號-4 Copyright ? 2016 學(xué)習?shū)B(niǎo). 頁(yè)面生成時(shí)間:0.681秒