I'm trying to create a function that allows insertion anywhere in a linked list...here is what I have so far but it isn't quite working
void llAddAtIndex(LinkedList** ll, char* value, int index) { LinkedList* newNode; // newNode = (LinkedList*)malloc(sizeof(*newNode)); newNode = *ll; if(index == 0){ newNode->next = newNode; newNode = newNode; } else { LinkedList* n = newNode; for(int i = 0; i < index; i++){ n = n->next; } newNode->next = n->next; n->next = newNode; } }