I honestly don't really understand how this code works. To make it work would I just need to change the type of some of the functions or would I need to change more than that?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct LinkedList{
int data;
struct LinkedList* next;
};
int main(){
struct LinkedList *A = NULL;
insert(A, 3);
printList(A);
return 0;
}
void insert(struct LinkedList *root, int item){
root=malloc(sizeof(struct LinkedList));
root->data= item;
root->next = NULL;
}
void printList(struct LinkedList *head){
struct LinkedList *temp=head;
while (temp != NULL){
printf("%d", temp->data);
temp = temp->next;
}
}