Compiler
Translates source code (written in programming languages) into machine code (0s and 1s)
4 steps of “compiling”
Preprocessing
- Preprocessor directives (like
#include <stdio.h>
) is directly copied and pasted into your code - A prototype is a hint to the compiler that the function will exist later
void meow(void);
Compiling
- gets the preprocessed code & translates it to assembly code
Assembling
- convert the assembly code to binary
Linking
hello.c cs50.h stdio.h
- code from your included libraries is converted also into machine code and combined with your code
-o
just specifies what file the linker outputs at the end of the day- you can reverse the process “decompile”, but it becomes ambiguous to do so