NjcwNTM0ZGE0YWQzNTQzOWI5YjFkYjgwOWFjZjE0Y2EzZDFlYmM0NjczMzY3YWFlM2M1Yzc3MTcxNzNhYzA5Yg.mu8e3hse.eyJ1cmwiOiIvcGwvY291cnNlX2luc3RhbmNlLzEvaW5zdGFuY2VfcXVlc3Rpb24vNjEvIiwiYXV0aG5fdXNlcl9pZCI6IjEifQ
Skip to main content Accessibility guide
PrairieLearn Go home
  • XC 101, SectionA
  • Assessments
  • Gradebook
  • C2
Load from disk
  • Dev User student
    View type
    ✓ Staff view staff ✓ Student view student ✓ Student view without access restrictions student
    Effective user
    Customize…
    Course Requests Settings Log out

Regenerate assessment instance

Warning: Regenerating the assessment instance will select a new set of questions from this assessment. Any progress on the current assessment instance will be lost.

Are you sure you want to regenerate the assessment instance?

Course staff: Regenerate your assessment instance to pick up changes to the assessment or to get a fresh set of questions.

C2.18. Autograder demo: Remove linked list element in C (Check Framework)

Assume that a linked list data structure has been defined in list.h as follows:

1
2
3
4
5
6
7
8
struct node {
  int value;
  struct node *next;
};

struct list {
  struct node *head;
};

Assume that for a list l, the element l->head points to the first element of the list.

Implement the following function that deletes the first element of the list. All other elements of the list should remain in the list in their original order. The function must return the value of the element that was deleted. The element deleted from the list must be properly de-allocated. If the list is originally empty, the function should return -1, and should not change the list (i.e., it must remain empty).

Caution: be extra careful not to use values after they have been freed.

Note: you don't need to write the main function.

deletefirst.c
Editor Settings

Correct answer

Collection 2

Assessment overview
Total points: 0/68
Score:
0%

Question C2.18

Value: 1
Total points: — /1
Auto-graded question

This form is only for reporting errors in the question itself. Do not use this form if you just don't know how to answer the question.

Previous question Next question

 Personal Notes

No attached notes

Attached files will be saved here for your reference. These files act as personal notes and can be used for your own review purposes. They are not used for grading.

Max file size: 10 MB

Attached personal notes will be saved here for your reference. These notes can be used for your own review purposes. They are not used for grading.

Staff information

Student details

Dev User
dev@example.com

Question

QID:
demo/autograder/c/linkedListDelete
Title:
Autograder demo: Remove linked list element in C (Check Framework)

Variant

Started at:
2026-09-19 07:54:47 (CDT)
Duration:
0s
Show/Hide answer
{}

Assessment instance

Assessment:
demo/externalGrading
Started at:
2026-09-18 22:13:44 (CDT)
Duration:
0s
View log
This box is not visible to students.