Question:
what is the difference between compile time error & run time error in turbo c programming?
bubu74
2013-08-07 00:27:20 UTC
I've seen some of c programming mcq qs has given 4 option in between two are run time error & compile time error.how can i justify between them..?
Six answers:
Prachi
2016-04-24 10:03:20 UTC
Runtime Vs Compile time Errors in C#

The difference between compile time and run time is an example of what pointy-headed theorists call thephase distinction. It is one of the hardest concepts to learn, especially for people without much background in programming languages. To approach this problem, I find it helpful to ask



What invariants does the program satisfy?

What can go wrong in this phase?

If the phase succeeds, what are the postconditions (what do we know)?

What are the inputs and outputs, if any?

Compile time

The program need not satisfy any invariants. In fact, it needn’t be a well-formed program at all. You could feed this HTML to the compiler and watch it barf…

What can go wrong at compile time:

Syntax errors

Typechecking errors

(Rarely) compiler crashes

If the compiler succeeds, what do we know?

The program was well formed—a meaningful program in whatever language.

It’s possible to start running the program. (The program might fail immediately, but at least we can try.)

What are the inputs and outputs?

Input was the program being compiled, plus any header files, interfaces, libraries, or other voodoo that it needed to import in order to get compiled.

Output is hopefully assembly code or relocatable object code or even an executable program. Of if something goes wrong, output is a bunch of error messages.

Run time

We know nothing about the program’s invariants—they are whatever the programmer put in. Run-time invariants are rarely enforced by the compiler alone; it needs help from the programmer.

What can go wrong are run-time errors:

Division by zero

Deferencing a null pointer

Running out of memory

Also there can be errors that are detected by the program itself:



Trying to open a file that isn’t there

Trying find a web page and discovering that an alleged URL is not well formed

If run-time succeeds, the program finishes (or keeps going) without crashing.

Inputs and outputs are entirely up to the programmer. Files, windows on the screen, network packets, jobs sent to the printer, you name it. If the program launches missiles, that’s an output, and it happens only at run time
Techhub
2013-08-07 00:39:32 UTC
Compile time errors are caught by compiler when we compile the program for errors such as incorrect syntax in the program, whereas run time errors arise when the program is running. For example one has created a program which performs division function. Now While running if one attempts to divide anything by zero results in run time error.
2013-08-07 03:32:47 UTC
Compile time error means syntax error and run time error means logical error.

Ex. like you type a c program for plus two numbers like this

c=a+b

this give you compile time error because semicolon missing if you type

c=a/b;

this is right for compiler but you want to plus two numbers so it answer is not right this is run time error .
deeksha
2016-01-02 23:53:58 UTC
Compile time errors are those errors which occur at the time of compilation.

They can be debugged during compilation.

Run time errors are those errors which occur during run time.

They are missed during compilation.
2013-08-07 21:21:24 UTC
int c=5; // this is a run time error coz division by 0 is not possible

int n= 0;

cout<




int m // this is compile time error coz of missing semicolon -> ;

int n;
?
2016-02-21 15:45:19 UTC
See -- https://reimagefix.im


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Continue reading on narkive:
Loading...