Add to end of a single linked list Segmentation fault C -
i'm trying make c application adds elements @ end of single linked list segmentation fault after read last element. i use function addatendsll() add element @ end. //program add elements @ end of single linked list #include <stdio.h> #include <stdlib.h> //basic declaration of sll struct singlelist{ int data; struct singlelist *next; }; //add element @ end of sll int addatendsll(struct singlelist **startptr, int value){ struct singlelist *newnode; newnode = (struct singlelist *)malloc(sizeof(struct singlelist)); if(newnode == null){ printf("\nfailed allocate memory"); return; } newnode->data = value; newnode->next = null; if(*startptr == null){ *startptr = newnode; } else { struct singlelist *temp = null; temp = *startptr; while(temp->next != null){ temp = temp->next; } temp->next = newnode; } } int main() { int...