- TP0: Introduction to C, and VSCode (making sure you can debug)
- TP1: Simple data types and pointers
- TP2: Stack, Queue, List
- TP3: Trees, AVL Trees
- TP4: Graphs
- TP5: Hashing, Hash Tables, chaining, linear probing
If not installed, download and install Visual Studio Code. If not installed, install it with:
Make sure you install the C/C++ extension for VSCode. This should provide intellisense, code navigation, and debugging features.
If you are on Windows, follow these steps:
- install MSYS2 and always run commands from MSYS2's terminal.
- Execute
pacman -Syuto update the package list (hit 'Y' when prompted). Re-start MSYS2 and do the same forpacman -Su. - Search for MINGW in the start menu and open the MINGW64 terminal.
- Run
pacman -S mingw-w64-x86_64-gccto install the GNU C Compiler. - Run
pacman -S mingw-w64-x86_64-gdbto install the GNU Debugger. - Run
pacman -S mingw-w64-x86_64-makeandpacman -S maketo install Make. - Add the
bindirectory of MSYS2 to your system's PATH environment variable. This is usuallyC:\msys64\mingw64\bin. - If not yet installed, install git from the official website.
Linux:
- Run
sudo apt-get updateto update the package list. - Run
sudo apt-get install gccto install the GNU C Compiler. - Run
sudo apt-get install gdbto install the GNU Debugger. - Run
sudo apt-get install maketo install Make. - If not yet installed (check with
git --version), install git withsudo apt-get install git.
MacOS:
- Install Homebrew. This is a package manager for MacOS. You can install it by running the following command in your terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"- Run
brew install gccto install the GNU C Compiler. - Install VSCode (next section) and install the CodeLLDB extension for VSCode. You will use
lldbinstead ofgdbfor debugging. - Run
brew install maketo install Make. - If not yet installed (check with
git --version), install git withbrew install git.
You should now be able to debug your code!
Do the following steps to run tp0:
- Open the core folder in VSCode (
sdd). - Open
src/tp0/main.cin VSCode. - Add a breakpoint (red dot) on line 15.
- Select "Run and Debug" from VSCode's sidebar, then select "tp0 macos", "tp0 linux" or "tp0 windows" from the top-left dropdown menu depending on your OS.
- Press the green play button to start debugging. If the code stops at the breakpoint, you are ready to go!
We are going to create a GitHub project. To do so, make sure you have a GitHub account that uses your institutional email address (@etu.unige.ch). We strongly recommend getting GitHub Pro for free through your institutional e-mail at this link: https://education.github.com/pack.
- Go to your personal github and create a new project called
sdd. Make sure you make the repository private!. Add Brian.Pulfer@unige.ch, Carmen.Zarola@etu.unige.ch and Yassine.El-Younsi@etu.unige.ch as collaborators. - Inside the
sdddirectory, run the following commands to set-up the git repos (only once):
git init # Initializes the git repo
git remote add origin LINK_TO_GITHUB_REPO # Adds the github repo as upstream
git branch -M main # Renames the branch to main
git add . # Adds all files to the staging area
git commit -m "Initial commit." # Commits the changes
git push -u origin main # Pushes the code to github --> Tests are triggered!- If you go back to the github page of your project, you should see that the files have been added.
The workflow is as follows:
- When given a new assignment, you will have to implement the functions in the
/libdirectory (e.g.lib/list/list.handlib/list/list.c), as well as in the main file for that assignment (e.g./src/tp2/main.c). - Once you have implemented the functions, you can test them locally with
make test_all(from MinGW64 terminal on Windows, or from the terminal on MacOS/Linux). - You can also test them by pushing your code to GitHub:
git add .
git commit -m "My commit message."
git push # (pushes to github) -> Monitor the tests on GitHub- If all tests pass, you are done! If not, go back to step 1.
- Teaching Assistants: Brian Pulfer, Victor Reyes Martin
- Monitors: Carmen Zarola, Yassine El-Younsi

