Name
queue_init
Synopsis
void queue_init(Queue *queue
, void (*destroy
)(void *data
));
Return Value
None.
Description
Initializes the queue specified by
queue
. This operation must be called
for a queue before the queue can be used with any other operation.
The destroy
argument provides a way to
free dynamically allocated data when
queue_destroy is called. It works in a manner
similar to that described for stack_destroy.
For a queue containing data that should not be freed,
destroy
should be set to NULL.
Complexity
O (1)
Get Mastering Algorithms with C now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.