#include <stdio.h>
#include <stdlib.h>
struct node {
int data;
struct node *link;
};
void addcll(struct node **, struct node **, int);
void displaycll(struct node *);
void main()
{
struct node *front, *rear;
front = rear = NULL;
addcll(&front, &rear, 56);
addcll(&front, &rear, 12);
displaycll(front);
}
void addcll(struct node **f, struct node **r, int item) {
struct node *q;
q = malloc(sizeof(struct node));
q->data = item;
if (*f == NULL) {
*f = q;
}
else {
(*r)->link = q;
(*r) = q;
(*r)->link = *f;
}
}
void displaycll(struct node *f) {
struct node *q, *p;
q = f;
p = NULL;
while (q != p) {
printf("%d \n", q->data);
q = q->link;
p = f;
}
}
Невозможно выяснить, где именно ошибка, пожалуйста, помогите! Также я новичок в структурах данных. Пожалуйста, дайте мне несколько советов о книге или онлайн-ресурсах, где я могу изучить и применить на практике эти понятия