Hi..
I am tryin to add nodes to a FRONT of a link list (struct) which contains a number in each..I need to it recursively..
Problem with the code is first pointer is a NULL pointer.. so after creating a new node i am able to add the value to the first input..But when the second input is entered and if i do EOF program crash..
CODE
List addFront(List list, int value) {
List element, temp;
if (list == NULL) {
element = newElement();
setElement(element, value);
element->next = temp;
} else {
list->next = addEndIterative(list->next, value);
}
temp = list;
return(element);
}
How can i save the first pointer when the function is called..coz i think i need to equal "element->next = temp;"
Can anyone plz help me with this..Ask if u can't understand the above..