Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 1

Errors The errors are categorized into four types: (i) Syntax errors: these are grammatical errors

detected by the compiler. If any syntax error is present in the program, the compiler will display the corresponding error message during the compilation of the program. Eg: the statement, printf(Hello World) will give a syntax error as ; is missing in the statement. Hence we need to put a ; after the printf statement and then compile and run the program to get the output. (ii) Linking errors: these may occur during the linking process. For eg. If we call a function in main() which is not defined then a linking error will occur and corresponding error message will be displayed. Execution time errors: we will not get the desired result even if our program is successfully compiled and linked. The results may be wrong due to errors in logic or division by zero, square root of a negative number is calculated which is not possible in system etc. we need to check out for such errors through debugging and correct them before proceeding. Logical errors: these may occur due to errors made by the programmer in the logic of the program. We will not get the correct results due to such errors in our program. For eg, if the no of days in a month is entered as 32 (by mistake) for calculating the wages of an employee and no check is made for no of days entered then calculation will be certainly wrong. So, its the duty of a programmer to avoid such errors to get the accurate results.

(iii)

(iv)

Executing a program: A program coded in C language is executed through the following steps: (i) (ii) (iii) (iv) Create the source code. Compile it. Link the programs with functions using the C library. Run/execute the program.

You might also like