13 lines
248 B
Text
13 lines
248 B
Text
transmorphic scalar list_pop(struct list scalar a) {
|
|
transmorphic scalar x
|
|
if (a.head == NULL) {
|
|
_error("empty list")
|
|
}
|
|
x = (*a.head).value
|
|
if (a.head == a.tail) {
|
|
a.head = a.tail = NULL
|
|
} else {
|
|
a.head = (*a.head).next
|
|
}
|
|
return(x)
|
|
}
|