This lab was developed by Prof. L. Felipe Perrone. Permission to reuse this material in parts or in its entirety is granted provided that this credits note is not removed. Additional students files associated with this lab, as well as any existing solutions can be provided upon request by e-mail to: perrone[at]bucknell[dot]edu
It should go without saying that all the work that you will turn in for this lab will be yours. Do not surf the web to get inspiration for this assignment, do not include code that was not written by you, do not have AI generate code for you. You should try your best to debug your code on your own, but it’s fine to get help from a colleague as long as that means getting assistance to identify the problem and doesn’t go as far as receiving source code to fix it (in writing or orally).
Choose a programming text editor to use. We will not use any IDE (such as Eclipse or Visual Studio) so that you can start to develop some self-reliance. (This will prepare you to transition into CSCI 315 later on.) Choose one of the two following editors to us this semester:
There are reference cards and tutorials for these editors everywhere on the Internet; find one that works for you. You will want to know how to create new files, open files, save files, and use any editor functionality that might help you when writing programs.
All the programming work for this course will be turned in via a git repository. You need to take some time to set up your repo.
git config –global user.name “youruserid”
git config –global user.email “youruserid@bucknell.edu”
cd csci307
git init
git remote add origin git@gitlab.bucknell.edu:youruserid/csci307.git
touch README.md
git add README.md
git add .
git commit -m ‘repo setup’
git push --set-upstream origin main
Dig deeper into git. If you want to start exploring features of git that you don’t quite master, here’s a tutorial to get you started; feel free to look for others if you don’t like it. YouTube has many interesting video tutorials, if your learning style is more visual.
As you are working with the C language, http://cdecl.or) can help you “translate” a line of C code into English. It might come in handy when you are trying to understand whether the code you wrote really means what you think it means.
Before you start, do the following on a terminal:
cd ~/csci307/Labs/Lab1
cp ~perrone/csci307/Labs/Lab1/* .
Complete the code for the following functions in file slist.c: namely slist_create, slist_add_front, and slist_add_back. Instructions for what you need to do are provided in the file itself. You can use the Makefile provided to compile your code with:
$ make slist.o
Complete the code for the traverse function in file slisttest.c. This function will exercise the code you wrote for Problem 1 and expose bugs you may have introduced. When you are done editing your code, compile it with the Makefile provided by doing:
$ make
After you debug your code and get everything working correctly, add, commit and push your files to your gitlab as follows:
git add *.h
git add *.c
git commit -m "lab1 completed"
git push
The rubric below shows the number of points that will be earned for each item that compiles and runs correctly. If the item does not compile correctly, 60% of the total points will be deducted. If the item compiles correctly and runs with major errors, 40% of the total points will be deducted. If the item compiles correctly and runs with minor errors, 20% of the total points will be deducted.