I would strongly recommend not responding to threads that have been dead for over two years, especially when the answer you're giving is unquestionably incorrect.
Why is your answer wrong? Well, first off, it does not address the matter of loading the compiled code into memory, and more importantly, of loading it correctly. Unlike with assembly language, there really isn't any option with most compilers to generate raw binary image files which can be loaded directly into memory; rather the generated code is going to be in an 'executable' format that contains relocation tables and other information that needs to be handled before the actual binary can be computed.
Worse, on the x86 and x86-64 platforms, your answer pre-supposes 16-bit C/C++ code, which few modern compilers will generate. In order to run the 32-bit or 64-bit code which are the mainstays of modern operating systems, you would need to switch into protected mode (or long protected mode) before running the C code, which means that the page tables, interrupt descriptors, and so forth would have to be in place before calling the compiled code.
Schol-R-LEA
Veteran Poster
1,089 posts since Oct 2010
Reputation Points: 495
Solved Threads: 174
Skill Endorsements: 13
Oh? What compiler were you using, and how did you coax it to produce raw binaries?
(On a guess, it was Turbo C, correct? And you simply created a .COM file? That would work, but it would be quite limited.)
Schol-R-LEA
Veteran Poster
1,089 posts since Oct 2010
Reputation Points: 495
Solved Threads: 174
Skill Endorsements: 13