I'm about to implement my own elementary data structures. Here is a class of list. I'm in struggle to fix the insert(int data) .
Idea: each element has a value and 3 pointer: pointer1: head: Points to the head cell pointer2: current: Points to current cell pointer3: next: Points to the structure of neighbor element
I already tried next = &date whenever we put a new element into the list. enter code here`
class list{
private:
typedef struct element{
int wert;
element *next;};
element *current;
element *head;
public://constructur.
list()
{head=new element; current=head; head->next=0;}
/*A new element with value is beeing inserted */
void insert (int value){
next= &value;}
};