Week 2
How to download source code into CS50 IDE
-
Log into ide.cs50.io using your GitHub account.
-
In your terminal window, type
wget https://cdn.cs50.net/2020/fall/lectures/2/src2.zip
followed by Enter in order to download a Zip file of lecture’s source code into your IDE.
-
In your terminal window, type
unzip src2.zip
followed by Enter to unzip (i.e., decompress) that Zip file.
-
In your terminal window, type
cd src2
followed by Enter in order to “change directory” into that
src2
directory (i.e., folder). -
In your terminal window, type, e.g.,
make hi
followed by Enter in order to compile, e.g.,
hi.c
(source code) intohi
(machine code). Or, you can type, e.g.,clang -o hi hi.c
which is equivalent. If a program uses the CS50 Library, though, be sure to add
-lcs50
to the end of that latter command. (By contrast,make
takes care of all of those “command-line arguments” for you.) -
In your terminal window, type, e.g.,
./hi
followed by Enter in order to run, e.g.,
hi
.
- Lecture
- Notes
- Slides
- Source Code
- Video
- Quiz 2
- Shorts
- Lab 2
- Problem Set 2