I am trying to add a node to the end of a singly linked list but am getting a segmentation fault (core dumped error)
void slist_add_back(struct slist *l, char *str) {
struct snode *temp;
do {
l->front = l->front->next;
l->counter++;
} while (l->front !=NULL);
l->counter++;
temp = (struct snode *)malloc(sizeof(struct snode));
l->back = l->front;
l->back->next = temp;
l->back = temp;
}
frontrepresent the front of your list? If so, you don't want to be changing it just because you're adding another element here.