I want some information about each programming error type ?

2007-01-13 11:05 pm
I want some information about each programming error type ?
specific the type name and one example for each it ok

Thank

回答 (1)

2007-01-14 3:41 am
✔ 最佳答案
In fact, what programming error you receive depends on the language you use, but they can be classified into three kinds:

1) syntax error
http://en.wikipedia.org/wiki/Syntax_error

This is the error that your code violates the syntax rule of the language.
E.g., for the code below:
for (int i=0;i != n;i++)....
In C++, it is OK, but in C, it receives a syntax error

2) runtime error

This is the error that your program crashes during runtime. This includes:
- accessing invalid memory in your program. E.g.:
int A[10];......A[11] = 11;
- arithmatic violation. E.g.:
int a, b;
a = 2; b = 0;
a = a/b; <- divide by zero error !

3) logical error
http://en.wikipedia.org/wiki/Logic_error

This is the error that cuased by wrong codes. This error is mostly refered as "bugs". This includes various kinds, for examples:
- infinite looping
E.g. while(1);
- wrong output
E.g. calculate sum of 1..10
int sum = 0;
for (int i=1;i != 10;i++) sum += i;
printf("%d", sum);


收錄日期: 2021-04-23 16:34:39
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20070113000051KK02442

檢視 Wayback Machine 備份