KarimS
KarimS

Reputation: 3902

How binary file can be portable in C programming?

After reading some C programming books, I would like to understand something about portability. C code is portable, but must be recompiled on each machine, so that the compiler can generate the right assembler and binary code for the processor.

Yet, when I download games (portable games) that contain some files, the .exe files work without needing to be recompiled on my machine.

So, how can be there a portable .exe?

Upvotes: 2

Views: 360

Answers (1)

SLaks
SLaks

Reputation: 887469

All Windows machines use the same two architectures (x64 or x86).

That means that if you want to run on a different architecture, such as Linux, you need to recompile.

Upvotes: 8

Related Questions