My solutions to Harvard University's CS50 Introduction to Computer Science course offered at edX. I used both CS50's CS50 IDE and my own text editor (Sublime Text) on Linux (Ubuntu) and macOS respectively, together with CS50's C library - libcs50. Library references can be found here.
The teaching staff at Harvard CS50 have taken time to preconfigure the CS50 IDE environment for us, so clang works a bit differently on the IDE compared to your local development environment. To compile the C files using clang execute the following command (make sure you have CS50's library for C installed):
clang -o [output file name] [file name].c -lcs50
If you don't want to type out the clang command everytime you want to compile your C file, you can configure Make temporarily by executing the following commands in terminal.
cd
nano ~/.bash_profile
Paste the following lines at the beginning of the file and save it.
export CC="clang"
export CFLAGS="-ggdb3 -O0 -std=c99 -Wall -Werror"
export LDLIBS="-lcs50 -lm"
Now, to compile your C files:
make [name of C file without the .c extension]
The table below shows my scores for the weekly problem set submissions.
Problem | Correctness (out of 5) | Style (out of 5) | Score |
---|---|---|---|
Scratch | 5 | - | 100% |
Hello | 5 | 5 | 100% |
Mario (Less) | 5 | 5 | 100% |
Mario (More) | 5 | 5 | 100% |
Cash | 5 | 5 | 100% |
Credit | 5 | 5 | 100% |
Caesar | 5 | 5 | 100% |
Vigenere | 5 | 5 | 100% |
Crack | 5 | 5 | 100% |
Music | 5 | 5 | 100% |
Whodunit | 5 | 5 | 100% |
Resize | 5 | 5 | 100% |
Recover | 5 | 5 | 100% |
Licensed under GNU General Public License.