Java vs C – What Does C Have Equivalent to JVM?

cjava

I know that C has a compiler but what determines execution performance?

For example in an if else block, what if the code just had all ifs instead of if elses, what determines that all the ifs will be ran? In Java it would be the JVM, but in C what is the execution compiler thing?

Best Answer

In Java the virtual machine executes your code, but C compilers generate code that the real machine executes. To be precise, in both cases your program ends up being converted into real machine code, but in the case of Java there's a middle step of compiling to JVM bytecode.

So Java programs are converted to real instructions by the JVM when you load them, whereas C programs are already converted to real instructions by the compiler before they're run.

Related Topic