✔ 最佳答案
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);