Definition of Source Code

Source code is the human-readable stage of computer programming

Source code is the list of human-readable instructions that a programmer writes—often in a word processing program—when he is developing a program. The source code is run through a compiler to turn it into machine code, also called object code, that a computer can understand and execute. Object code consists primarily of 1s and 0s, so it isn't human-readable. 

Source Code Example

Source code and object code are the before and after states of a computer program that is compiled.

Programming languages that compile their code include C, C++, Delphi, Swift, Fortran, Haskell, Pascal and many others. Here is an example of C language source code:

/* Hello World program */





printf("Hello World");


You don't have to be a computer programmer to tell that this code has something to do with printing "Hello World." Of course, most source code is much more complex than this example. It is not unusual for software programs to have millions of lines of code. Windows 10 operating system is reported to have about 50 million lines of code.

Source Code Licensing

Source code can be either proprietary or open. Many companies closely guard their source code. Users can use the compiled code, but they cannot see or modify it. Microsoft Office is an example of proprietary source code. Other companies post their code on the internet where it is free to anyone to download.

Apache OpenOffice is an example of open source software code.

Interpreted Program Languages Code

Some programming languages such as JavaScript are not compiled into machine code but are interpreted instead. In these cases, the distinction between source code and object code does not apply because there is only one code.

That single code is the source code, and it can be read and copied. In some cases, developers of this code may intentionally encrypt it to prevent viewing. Programming languages that are interpreted include Python, Java, Ruby, Perl, PHP, Postscript, VBScript and many others.