Assignment 01: Hello CS240!
Due Friday, September 5th, before midnight
The goals for this assignment are:
-
Sign into a lab computer
-
Setup an SSH key for github
-
Clone your classwork repository
-
Using either Vim, Emacs, or Nano, write a simple C program
-
Sign into slack
1. Sign into a lab computer
As a CS students, you should have received a username and password from our IT administrator, David Diaz. Use this account information to log into one of the desktops in our lab while they are running Linux.
To log into Ubuntu, you should use your CS username and password. |
Our lab machines are dual boot. This means that they can boot either Windows or Ubuntu Linux. For class, you will need to boot them with Ubuntu.
2. Sign-up for Github
If you do not have one already, please create a github account.
3. Setup an SSH Key for github
SSH refers to "Secure Shell Protocol" and it ensures that the information transferred between your local machines and github are secure.
If you have not done this before, follow the instructions here.
4. Setup your classwork repository
4.1. Get the download link
From your github account, copy the repository url from Github. It should look similar to the following (note that URLs and repository names may be different!)

Make sure you have SSH selected for the URL type |
4.2. Clone the repository
From the terminal, use git clone <download_url>
to download your class repository.
If everything is setup correctly, you should see output similar to the following.
$ git clone git@github.com:BrynMawr-CS240-F25/cs240-f25-classwork-alinen.git
Cloning into 'cs240-f25-classwork-alinen'...
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 9 (delta 0), reused 8 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (9/9), 13.83 KiB | 2.30 MiB/s, done.
5. Simple C programs
You will need to learn one of the following terminal editors for this course.
-
Nano: Documentation
-
Emacs: Documentation
Open a terminal and complete the following exercises with one of the above editors.
5.1. hello.c
In the directory A01
, edit the file, hello.c
, to print the string "Hello World".
$ vi hello.c
$ gcc hello.c
$ ./a.out
Hello World
The above directly calls the C compiler to build the executable a.out
.
However, it is better to use a Makefile for building. A Makefile allows us
to avoid re-writing complex build rules as our executables become more complicated.
Try writing the following Makefile.
Make sure to use indent and not spaces! |
CC=gcc
SOURCES=$(wildcard *.c)
FILES := $(subst .c,,$(SOURCES))
FLAGS=-g -Wall -Wvla -Werror -Wno-unused-variable -Wno-unused-but-set-variable
all: $(FILES)
% :: %.c
$(CC) $(FLAGS) $< -o $@
clean:
rm -rf $(FILES)
Now, run the following to build.
$ make hello
$ ./hello
Hello World
Notice that we use make
and not gcc
. Also notice that the executable is named hello
and not a.out
anymore.
5.2. Cool hello.c
Extend the program, hello.c
, to implement a small demo of your choosing.
For example, you might implement a simple game, a puzzle generator, or a fortune generator.
Requirements:
-
Your demo should build with
make
without errors -
Your demo should include a comment at the top that contains sample output from your program
Submit your work to Github
Add and check in your program using git and then push your changes to Github.
Run the following command inside your A01
directory.
$ cd A01
$ git add *.c Makefile
$ git commit -m "Descriptive message"
$ git push
Run git status
to check the result of the previous git command.
Check the Github website to make sure that your program uploaded correctly.
6. Join the slack group
I will be inviting you all to join the course slack channel. In the
#social
channel, say and introduce yourself:
-
What is your preferred name and pronouns?
-
Share with us your favorite emojji. :)
We will use Slack for
-
Course announcements
-
Questions and errata for assignments and labs
You can also use Slack to talk directly to me and the TAs, or even to each other.
Grading Rubric
Assignment rubrics
Grades are out of 4 points.
-
Github setup (1 points)
-
Slack setup and introduction (0.5 points)
-
C program and Makefile (2.5 points)