Hello and welcome to CS50!
My name is Omer, and I’m going to be your TF for this semester. I’m really excited to get to know all of you and help you learn computer science!
Welcome to the first section of CS50! This week we will be learning programming fundamentals in C. C is a powerful language that is used in many different applications, from operating systems to video games. It is a great language to learn because it is relatively low-level, meaning that you have a lot of control over how your code runs. This week we will be learning about variables, conditionals, loops, and more!
Resources:
Section-Specific:
- Sections are held Thursdays 9AM-11:45AM in 2 Arrow St. Room 420
- Section Slides
Course-wide:
- Week 1 Lecture Notes
- Week 1 Lecture Slides
- Problem Set 1: C Due Sunday, Sep 15, 2024 11:59PM
- Syllabus
- Course FAQs
- Previous Year’s Feedback/Advice
Office Hours:
- My Office Hours: Saturday, September 14 1-2pm in HSA 4th Floor (67 Mt. Auburn Street)
- May change in the future
- All-Staff Office Hours: Sunday 3-5PM in Widener Library
- Office Hours Schedule
- Add this Google Calendar
- If you have any questions at all, email me!
Terminal Commands
Make a folder/subdirectory
$ mkdir world
Your folders will now look like this on the left side of VS Code:
other-folder1/
other-folder2/
world/
Enter a folder in terminal
$ cd world
You will now be in the world
folder:
world/ $
List contents of a folder
$ ls
You will see the contents of the folder:
$ ls
other-folder1/ other-folder2/ world/
$
Exit a folder / go to a higher-level folder
psets/1/ $ cd ..
You will know be in the parent folder psets
:
psets/ $
Create a file
$ code hello.c
Compile a C file
$ make hello
Run a C file
$ ./hello
Common Patterns for the Problem Set
do while
loops
int input;
do
{
input = get_int("Enter an integer: ");
}
while (input < 0)
printf
printf
prints a formatted string to the terminal:
// print text
printf("hi\nhi")
// print the value of variables
int num = 2
printf("the value of this number is %i", num)
// can also do for strings, doubles, floats, etc. (%s, %d, %f, etc.)