Basic queue implementation in C
I'm not able to review the functionality of the code currently, but to address your concerns:

In dequeue(), rather than returning the node, add a parameter (pointer to QueueNode) to store that node in. This is similar to functions like memcpy(3), strtoul(3) (end pointer), and so on. It allows you to return an error value however you wish.

int dequeue(struct Queue *queue, struct QueueNode *out);


If the queue is empty, don't bother modifying out, and just return an error code.

I would also avoid printing &amp; exiting from within the queue's functions upon error. Instead return some kind of error value and leave it for the user to check.

For example, consider if malloc fails. The user may want to check errno, or use a fallback data structure.

int enqueue(struct Queue *queue, int num) {
    struct QueueNode *queuenode = malloc(sizeof(struct QueueNode));

    if(queuenode == NULL){
        return -1;
    }

    queuenode-&gt;data = num;
    queuenode-&gt;nextNode = NULL;

    if(!queue-&gt;priorNode){
        queue-&gt;priorNode = queuenode;
    }

    if(queue-&gt;lastNode){
        struct QueueNode* temp = queue-&gt;lastNode;
        queue-&gt;lastNode = queuenode;
        temp-&gt;nextNode = queue-&gt;lastNode;
    } else {
        queue-&gt;lastNode = queuenode;
    }

    return 0;
}