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