Compile Time Errors
Let us look at an example of compile time error.
/*
* -----------------------------------------------------------
* Logic Building with Computer Programming (CSU1128P)
* Instructor: Abdullahi Adem | Author: Divya Mohan
*
* This code is a part of the educational initiative by dmj.one
* with aim of empowering and inspiring learners in the field of
* Computer Science and Engineering through the respective courses.
*
* (c) 2022, Divya Mohan for dmj.one. All rights reserved.
* -----------------------------------------------------------
*/
#include <stdio.h>
int main() {
int a = 1;
int b = 2;
int c = a + b
return 0;
}
Output
gcc /tmp/gnqKaOW3lQ.c -lm
/tmp/gnqKaOW3lQ.c: In function 'main':
/tmp/gnqKaOW3lQ.c:5:3: error: expected ',' or ';' before 'return'
5 | int c = a + b
| ^~~
Run Time Errors
Let us look at an example of run time error.
/* *
*
* Logic Building with Computer Programming (CSU1128P) by Dr. Pankaj Vaidya and Abdullahi Adem
*
* This program contains all the programs done in the course
* Logic Building with Computer Programming with the course code CSU1128.
*
* DO NOT COPY
* DO NOT REPRODUCE
* DO NOT MODIFY
*
* (c) 2022, Divya Mohan for dmj.one. All rights reserved.
*
* */
#include <stdio.h>
int main() {
int a = 1;
int b = 2;
int c = a + b;
int d = c / 0;
return 0;
}
Output
Floating point exception