What is the Difference between compiling and running the code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the Difference between compiling and running the code?

I am too confused with these two terms please help me with it

14th May 2019, 9:48 AM
Mahesh Kancharla
Mahesh Kancharla - avatar
2 Answers
+ 4
Hi. While compiling usually translates the code from human readable to machine readable and especially hardware specific commands, where running the code is the step that executes the commands understood by the processor (CPU, GPU, Any Processing Unit if the compiler is available). There is also a different type of programming language. So called interpreted languages or script languages. These are, so to say, read line by line and the interpreter directly calls the corresponding CPU commands. Hope that helps. Here is a small intro https://en.m.wikipedia.org/wiki/Interpreter_(computing)
14th May 2019, 10:00 AM
ChrA
ChrA - avatar
+ 3
Compiling is a step before running. The compiler validates your Code to be a valid word in your programming language (syntax check), and translates (compile or transpile - depends) it into ByteCode or Binary by adding (linking) Libraries and Metadata. Also optimization for execution is done in many cases. Compiling happens at so called compile time. Execution is running the code on the physical device (CPU's) (so called runtime).
14th May 2019, 10:00 AM
Daniel Adam
Daniel Adam - avatar