answersLogoWhite

0


Best Answer

Compile time errors are detected at the compilation of a program. These are usually syntactical errors. A program cannot be compiled and hence executed if it contains a compile time error.

for example,

int a b=0;

above statement will produce a compile time error as a and b must be separated by a comma(,).

Runtime errors are logical errors. They don't affect the compilation of the program but causes a program to produce unwanted output. The program becomes buggy.

for example,

sum=sum-a[i];

in above statement, no syntactical error is present and hence the program will get executed successfully. But from a logical point of view, sum was supposed to be the addition of array elements. using minus(-) instead of plus(+) will give unwanted or incorrect output.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

C is a high level language which means it is meant for humans to understand not computers. For a computer to understand a C program it has to be compiled, that is changed into machine language. Once a program is in machine language then the computer can understand it and perform the actions it describes (that is to run the program). A C program need only be compiled once but (once compiled) it can be run any number of times.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

Polymorphism is defined as one interface to control access to a general class of actions. There are two types of polymorphism one is compile time polymorphism and the other is run time polymorphism. Compile time polymorphism is functions and operators overloading. Runtime time polymorphism is done using inheritance and virtual functions.

Polymorphism means that functions assume different forms at different times. In case of compile time it is called function overloading. For example, a program can consist of two functions where one can perform integer addition and other can perform addition of floating point numbers but the name of the functions can be same such as add. The function add() is said to be overloaded. Two or more functions can have same name but their parameter list should be different either in terms of parameters or their data types. The functions which differ only in their return types cannot be overloaded. The compiler will select the right function depending on the type of parameters passed. In cases of classes constructors could be overloaded as there can be both initialized and uninitialized objects. Here is a program which illustrates the working of compile time function overloading and constructor overloading.

eg.

namespace CommonClasses { public interface IAnimal { string Name { get; } string Talk(); } } // Assembly: Animals using System; using CommonClasses; namespace Animals { public abstract class AnimalBase { public string Name { get; private set; } protected AnimalBase(string name) { Name = name; } } public class Cat : AnimalBase, IAnimal { public Cat(string name) : base(name) { } public string Talk() { return "Meowww!"; } } public class Dog : AnimalBase, IAnimal { public Dog(string name) : base(name) { } public string Talk() { return "Arf! Arf!"; } } } // Assembly: Program // References and Uses Assemblies: Common Classes, Animals using System; using System.Collections.Generic; using Animals; using CommonClasses; namespace Program { public class TestAnimals { // prints the following: // Missy: Meowww! // Mr. Bojangles: Meowww! // Lassie: Arf! Arf! // public static void Main(string[] args) { var animals = new List() { new Cat("Missy"), new Cat("Mr. Bojangles"), new Dog("Lassie") }; foreach (var animal in animals) { Console.WriteLine(animal.Name + ": " + animal.Talk()); } } } }
This answer is:
User Avatar

User Avatar

Wiki User

14y ago

A compile-time error occurs when you attempt to compile the program, for example a syntax error.

A run-time error occurs when you are running the program, for example the program asks you for a number, you enter a letter and the program crashes.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

Compilation time & execution time are diff to each other.When an instruction given by the user is performed by the processor,it is said that the particular instruction or command is executing.But before executing any instruction or a set of instruction,i.e.,a program,it is necessary to check whether the command given is given properly or whether the program is syntactical errorfree.This checking is called compilation.This job is done by the compiler or interpreter ont by the processor itself.


If the ans helps you,plz increase the trust point.

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

It was asked in an interview of mine, I could only tell that compiler selects method to call at runtime.

Lets say for example

Base b=new Derived();

b.someMethod();

What actually happens in compile time and runtime in above part.......

Expect answers from geeks only plz...... :)

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

Here's an answer from a geek: RTFM and stop bothering me (8^). The specification for method expression invocation can be found https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.12

The spec will give you all the details but in short:


Compilation: During compilation all the compiler cares about is finding the method signature. In your example "someMethod()" is what is written in the code and that's all there is to it. This is known as "static binding".



Runtime: When the program is running the JVM calls the "someMethod()" implementation that is appropriate for the runtime object referenced by "b". The variable "b" is a reference to the "Derived" object so the method defined in "Derived" is called. the JVM does what is called "method dispatch", also known as as "dynamic binding" (it happens dynamically).

This answer is:
User Avatar

User Avatar

Wiki User

15y ago

Very simply, Java compile time is when Java is in the process of compiling source code, and run time is when Java is actually executing your program.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

Compile time refers to when the compiler is turning source code into machine code.

Runtime refers to when your process is actually executing.

(Please don't advertise here.)

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

When you compile your project, you are in compile time. Runtime occurs when you execute the machine code generated by the linker (after compile time).

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between run time and compile time in c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the difference between compile time and run time polymorphism?

Runtime prolymorphism means overriding compiletile polymorphism means overloading


What is the difference between design time run time and break time?

Assuming you are refering to software development: Design time - Prior to compile Run time - After compile, while program is running Break time - Pausing the execution of code during the debugging process


What is the difference between run-time error and compile error?

A run-time is an error that occurs when the program is executing (running). This is where segfaults and other horrible things happen. A compile-time error is an error that occurs when you are compiling the code. This is where code syntax and semantics are checked. You want errors to only occur here.


Is overriding done at compile time or run time?

compile time


What is the difference between compile-time error and the run-time error?

A run-time is an error that occurs when the program is executing (running). This is where segfaults and other horrible things happen. A compile-time error is an error that occurs when you are compiling the code. This is where code syntax and semantics are checked. You want errors to only occur here.


What is compile time and run time?

Compile time is when the compiler translates your source code into computer language. Run time is when the actual program runs.


Difference between statically typed language and dynamically typed language?

Statically typed languages check type of variable at Compile time vs Dynamically typed language check type at run time


What is run time?

"run time" is the opposite of "compile time". It refers to the time when the program is actually running.


What is the difference between static memory versus dynamic memory?

Dynamic memory can be declared at run-time using the new and delete operators (or malloc and free in C), while static memory must be declared at compile-time.


Global variable conflict is at compile time or run time?

Linkage time.


Difine run time error?

run-time error definition. An error in the execution of a program which occurs at run time, as opposed to a compile-time error. A good programming language should, among other things, aim to replace run-time errors by compile-time errors.


What is compile time?

Compile Time: In longer form, you might say, "at the time of compiling", or, "when the program is compiled". When you compile a program, the compiler applies various processes to your source code in order to generate the executable files. These are actions that happen "at compile time". Other actions happen when you actually run the finished program. These actions are said to occur, at, or in, "run time".