# CSSE132 Coding Final: Mini Practice

Five independent C exercises; allow about 45–60 minutes including debugging.
These are practice tasks, not exam questions. Edit only `practice.c`.

On your course VM, save your editor files, then go to the top of your existing
course repository (the directory containing your homework and labs):

```bash
git status
git pull --no-rebase --ff-only
cd coding-final-practice
make
make test
```

Stop and ask your instructor if Git reports an error. Do not reset or discard
unfinished work. Normally, changes in other assignment folders can stay in place;
if Git asks you to commit or stash before pulling, ask for help preserving them.
You do not need to copy files or download the ZIP to use this released folder.
The ZIP on the review page is an optional alternative.

The starter compiles, but its TODO functions intentionally fail the tests.
`make` builds; `make test` runs all five exercise groups, even if one fails.
An assertion failure names the failed condition and source line. The test source
is provided: read it to understand the example. A compile error in practice.c
must be fixed before any group can run. Local tests are examples, not a proof
that every possible input works. There is no Gradescope submission for this set.

| Exercise | Function | Estimated time |
| --- | --- | --- |
| 1. Compare neighboring array readings | countDrops | 7–10 min |
| 2. Change an even integer through a pointer | halveEven | 5–7 min |
| 3. Count selected punctuation | countMarks | 7–10 min |
| 4. Record one sale in a struct | sellOne | 7–10 min |
| 5. Allocate consecutive integers | makeRamp | 9–12 min |

The full contracts, two examples per exercise, and TODOs are in `practice.c`.
All pointer inputs are valid. Follow the stated length and integer-range bounds.
You do not need networking, threads, assembly, or external libraries.

To test or debug just one exercise:

```bash
./test_practice pointers
gdb --args ./test_practice pointers
```

Replace `pointers` with `arrays`, `strings`, `structs`, or `heap` as needed.
In GDB: `run`, `bt`, `list`, `print n`, `next`, and `quit` are useful.
For heap, the caller must free every returned array exactly once. Never return
an address of a local array. Keep a separate pointer if you walk through a heap
block, so you can still free its original starting address.

Try each exercise before asking for help. Record the expected value, actual
value, and smallest input that fails. Discuss your reasoning in review;
complete solutions are held separately for instructor-led feedback.
