Programming Errors in C
ERRORs
Errors (bugs) cause programs to malfunction, even for experienced developers. Debugging is the process of identifying and fixing these errors.
This shortens the original text while retaining the key points: errors cause problems, developers make them, and debugging fixes them.
These errors are detected either during the time of compilation or execution. Thus, the errors must be removed from the program for the successful execution of the program.
There are mainly five types of errors exist in C programming:
- Syntax error
- Run-time error
- Linker error
- Logical error
- Semantic error
Very important thing is understanding errors in C programming
Identify the syntactic errors in the following program.
#include <stdio.h>
int main (Void)
(
INT sum;
/* COMPUTE RESULT
sum = 25 + 37 – 19
/* DISPLAY RESULTS //
printf("The answer is %i\n" sum);
return 0;
}
Identify the Errors
int main (Void)(}
INT sum;
/* COMPUTE RESULT
sum = 25 + 37 – 19
/* DISPLAY RESULTS //
printf("The answer is %i\n" sum);
Then type in and run the corrected program to ensure you have correctly identified all the mistakes.
#include <stdio.h>
int main (void)
{
int sum;
/* COMPUTE RESULT */
sum = 25 + 37 - 19;
/* DISPLAY RESULTS */
printf ("The answer is %i\n", sum);
return 0;
}
Comments