Source code is a list of human-readable instructions that programmers often write in word processing programs when developing programs. Source code is run through a compiler, converting it into machine code that a computer can understand and execute, also known as object code. Object code consists mostly of 1s and 0s, so it is not human readable.
Source code example
Source code and object code are the before and after states of a compiled computer program. Programming languages for compiled code include C, C#, Delphi, Swift, Fortran, Haskell, Pascal, and many more. Here is an example of C language source code:
/* Hello World program */ #includemain() { printf("Hello World") }
You don't have to be a computer programmer to tell that this code has to do with printing "Hello World". Of course, most source code is much more complex than this example. It's not uncommon for software programs to have millions of lines of code. According to reports, the Windows 10 operating system has approximately 50 million lines of code.
Source Code License
Source code can be proprietary or open. Many companies tightly guard their source code. Users can use the compiled code but cannot view or modify it. Microsoft Office is an example of proprietary source code. Other companies post their code on the Internet, where anyone can download it for free. Apache OpenOffice is an example of open source software code.
Interpreting Programming Language Code
Some programming languages, such as JavaScript, are not compiled into machine code but are instead interpreted. In these cases, the distinction between source and object code does not apply, since there is only one code. Individual codes are source code and can be read and copied. In some cases, the developer of this code may have intentionally encrypted it to prevent viewing. Interpreted programming languages include Python, Java, Ruby, Perl, PHP, Postscript, VBScript, and more.
The above is the detailed content of what is source code. For more information, please follow other related articles on the PHP Chinese website!