Top Categories
Difference between Compile-time, Run-time and Logical errors in C (hands-on) | C Programming
- Category:
- Sub Category:
If you are a beginner and looking for a complete course on C programming, visit the below link: https://www.aptuts.com/c-programming (Rare coupon code link - 90% Off) Compile time vs. Runtime vs. Logical errors in C programming. In this video, I will explain difference between compile time error,
If you are a beginner and looking for a complete course on C programming, visit the below link: https://www.aptuts.com/c-programming (Rare coupon code link - 90% Off) Compile time vs. Runtime vs. Logical errors in C programming. In this video, I will explain difference between compile time error, runtime error and logical error in C programming. By the end of this video, you should be able to differentiate between these 3 types of errors in C. There are different types of errors in C - Compile time error, run-time error and logical errors. Compile time error as the name says - these occurs during compilation process. One best example of compile time error is syntax error. Let’s say, you use printffs (typo) for printing text on the screen. If you try to compile your code, C compiler will throw an error saying program could not be compiled as it could not recognize printffs keyword. This is called compile time error. Run time error occurs during execution of the program. It can cause program to crash if not handled during the coding process. Classic example is division by zero. If your code has division operation and if division by zero is not handled inside the code, program will compile without any issue. However, if during program execution, denominator turns out to be zero, the program will crash as division by zero is not a legal operation. Then we have logical error. Logical error deals with the logic of the program code. Let’s say, I am writing a code that calculates average of 3 numbers. The formula to calculate average is (a+b+c)/3. However, while writing the code, I wrote (a+b)/3 instead of (a+b+c)/3. On compilation, program will compile successfully and on execution, it will execute perfectly fine without throwing any run-time error. However, the calculation of average of 3 numbers will be calculated incorrectly. Here, the logic written for calculation is incorrect. This is called logical error. This type of error will not make your program terminate unexpectedly. It will just add a bug in your program code which will result in unexpected output. ## Some helpful resources ## C programming course for beginners (with rare coupon code 90% off) - https://www.aptuts.com/c-programming Learn C programming online for FREE - https://www.learnconline.com/ Follow me on facebook page - http://fb.com/aptuts Free C programming cheatsheet - https://www.aptuts.com/free-c-cheatseet #aptuts #CProgramming #ErrorsInC