I have a function call addNode that should add a new node, but when I try it doesn't add any of them, it prints nothing, I've been trying for a few hours and I'm stuck on this.
#include <stdio.h>
#include <stdlib.h>
struct node
{
int value;
struct node *next;
};
typedef struct node Node;
typedef struct node *NodePtr;
NodePtr AddNode(NodePtr listStart, int value){
NodePtr newNode = malloc(sizeof(Node));
newNode->value = value;
newNode->next = listStart;
listStart = newNode;
}
void printList(NodePtr list){
NodePtr handledList;
while (handledList !=NULL)
{
printf("%d --> ", handledList->value);
handledList=handledList->next;
}
}
int main(){
NodePtr list;
AddNode(list, 5);
AddNode(list, 25);
AddNode(list, 15);
printList(list);
}