title: How can a single compiled C program run on multiple architectures?
body: <p>Take for example a program downloaded from some website, the different options to pick from are the usual operating systems (Linux, Mac, Windows) but what about CPU architecture? The program is a binary executable. Does it just assume amd64? Or is the program compiled into all of the supported architectures and packaged together with a script on top that chooses the right one?</p>
  
  <p>I'm only interested in C and would like to know how this is accomplished.</p>
  
  <hr>
  
  <p>On further investigation, thanks to the lovely information provided by the individuals below, I came across <a href="http://en.wikipedia.org/wiki/Fat_binary" rel="nofollow noreferrer">Fat Binaries</a> with support on both Mac and Linux. It doesn't seem as though windows <a href="https://stackoverflow.com/questions/7510225/windows-8-fat-binary-exe-for-x86-arm">supports</a> it.</p>