一般的程序錯誤,粗略一點(diǎn)分的話,可以大致分為語法錯誤和語義錯誤。
語法錯誤可以看作是編碼出現(xiàn)了違反C語言規(guī)則的錯誤,一般編譯或者鏈接時,
都會報(bào)錯的。
而語義錯誤,也可以叫做邏輯錯誤,
也就是說你的代碼完全符合C語言的規(guī)范,不會出現(xiàn)編譯/鏈接的錯誤,
但是,在邏輯上有錯誤。
舉個簡單的例子,
加入編一個代碼來統(tǒng)計(jì)int數(shù)組a的成員總和,成員總數(shù)為N:
for(int i=0;i<N;i++;) //這里在i++后面多了一個分號,這是語法錯誤
sum=sum+a[i];
for(int i=0;i<=N;i++) //這里多了一個i=N的取值,這是語義錯誤
sum=sum+a[i];
語言學(xué)范疇里的語義是指語用意義
語用意義是指話語在語言意義的基礎(chǔ)上由于語言使用者及語境的作用而產(chǎn)生的意義.
所謂語義錯誤通俗點(diǎn)說就是語言使用者在一定的語境中對語言的使用出現(xiàn)了錯誤
http錯誤包括很多種404是找不到網(wǎng)頁403是沒有權(quán)限瀏覽網(wǎng)頁,很多,你的是啥
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)站尊重并保護(hù)知識產(chǎn)權(quán),根據(jù)《信息網(wǎng)絡(luò)傳播權(quán)保護(hù)條例》,如果我們轉(zhuǎn)載的作品侵犯了您的權(quán)利,請?jiān)谝粋€月內(nèi)通知我們,我們會及時刪除。
蜀ICP備2020033479號-4 Copyright ? 2016 學(xué)習(xí)鳥. 頁面生成時間:0.681秒