--- title: Imperative Programming L+Pr description: This course is not about problem solving. It is about understanding C as a language, how programs are compiled, and how the machine executes them. You are expected to understand what you write, why it works, and why it sometimes does not. tags: - C - BSc - CS - ELTE - IP-18fIMPROGEG - Programming date: 2026-01-21T03:11:00 --- # Imperative Programming L+Pr ## DarthDemono’s Notes for Imperative Programming L+Pr / IP-18fIMPROGEG This course is not about problem solving. It is about **understanding C as a language**, how programs are compiled, and how the machine executes them. You are expected to **understand what you write**, why it works, and why it sometimes *does not*. - Course code: IP-18fIMPROGEG - Credits: 5 --- ### Setup (what you install + how you work) #### Windows (MSYS2 + GCC + VSCode) 1. [Install MSYS2](https://www.msys2.org/docs/installer/) 2. Update and install required packages (use any shell): ```bash pacman -Syu pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-gdb mingw-w64-x86_64-make ``` 3. [Add to `%Path%`](https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/) 4. Use **VSCode** as the editor (my recommendation, you can use `vim` or `nano` if you want) - Install the C/C++ extension - Make sure VSCode uses the MSYS2 `gcc` --- #### Linux (native, WSL, or server) 1. Install gcc ```bash sudo apt update sudo apt install gcc vim build-essential ``` 2. Editors: - `vim` - `nano` - VSCode ([remote](https://code.visualstudio.com/docs/remote/ssh) or local) *Note: In Comsys server you are expected to use vim/nano and gcc will be pre-installed* --- ### Compilation rules The instructor compiles using: ```bash gcc -g -fsanitize="address,undefined" -fno-omit-frame-pointer -W -Wall -Wextra -pedantic -Werror *.c ``` This: - enables runtime checks - catches undefined behavior - treats warnings as errors #### Windows limitation `-fsanitize` **does not work on Windows**. For local Windows practice, use: ```bash gcc -g -fno-omit-frame-pointer -W -Wall -Wextra -pedantic -Werror *.c ``` #### Final verification To be sure your code is correct, compile on: - WSL - or the comsys server - or a Linux VPS If it fails there, it is **not correct**, even if it “works on Windows”. --- ### End goal of the course By the end, you should be able to: - Compile clean C code - Use pointers safely - Manage dynamic memory allocation correctly with `malloc` - Design and manipulate `struct`-based data structures - Avoid undefined behavior - Input and Output data correctly - Understand 'run-time' and 'compile-time' processes --- ### Samples Some samples for what to expect for Exams #### [[Imperative programming L+Pr/particles/index\|particles]] #### [[Imperative programming L+Pr/canvas/index\|canvas]] --- ### Lecturers / Instructors Recommendations #### Books - [The C programming Language By Brian W. Kernighan and Dennis M. Ritchie.](https://www.google.com/search?q=The+C+programming+Language+By+Brian+W.+Kernighan+and+Dennis+M.+Ritchie) ---