The delivery note has no bay assigned yet. Check selected before reading through it, and keep the supplied NULL value for submission. To try the other branch, set it to &bay temporarily, run the program, and restore NULL afterward.
Bay not assigned if the supplied pointer is NULL; otherwise print Bay: 6 using *selected. Leave selected = NULL for submission, so the output is exactly Bay not assigned and a newline.Use if (selected == NULL); dereference only inside the else branch.