ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software»
  • Computer Science & Programming

What Is Computer Source Code?

Updated on August 18, 2013
Daffitt profile image

With a BS degree in Technical Management, I hope to provide useful and relevant articles on topics related to various technologies.

Source Code in Visual Studio


Source Code

A program is a set of instructions given to a computer to tell the computer what to do. Without these instructions, the computer is completely useless. Because computers can only understand instructions in the form of binary code (ones and zeros), there exists the need to translate human instructions into machine code (binary numbers). To do this, programmers write these instructions in a human readable form called source code. The image on the right is a sample of what source code would look like in the C++ programming language using Microsoft Visual Studio 2010 Professional. Click on it to enlarge the picture.

Once the source code is written and saved, it can then be converted (or compiled) into machine code. In the first stage of translation, the pre-processor seeks out special commands at the beginning of the file called pre-processor directives. These commands begin with the "#" symbol, and refer to what are called header files. The pre-processor translates these header files into source code, which can then be used to check the rest of the program for syntax errors.

Object Code

Syntax errors are caused by the programmer incorrectly using the various elements of the source code. Once all of the source code is processed and translated into machine code, also called object code, it is saved into what they call an object file.

Three Types of Code

Executable Code

Finally, the last stage of translating the programmer's instructions into something that the machine can execute is performed by a program called the linker. The linker brings the object code and the C++ Programming language's runtime library code together, and saves the resulting executable code as an executable file. This is the full program file that can execute (or be run) on your computer. On the left, you’ll see a graphic simulating the three codes.


Submit a Comment

No comments yet.