Hi all,
I'm a beginner in C++ trying to write himself a class for a new datatype that wouldn't be as "inflexible" as the default ones concerning storage capacity. I'm using linked lists to store the value of the number, and I wrote this piece of code to add a node to the end of the list, but I have absolutely no idea if it'll work. In fact, knowing how my experiments usually end, I have a hunch it won't But just to be sure, could anyone go over the code and tell me if it'll work or not?
Code:void large::createNode(storage_list** param) { storage_list *temp; //Create a temporary pointer temp = new storage_list; //Allocate memory temp->next_node = NULL; //Set pointer to next node temp->previous_node = *param; //Set pointer to previous node *param->next_node = temp; //Assign "value" lastNode = temp; //Set pointer defined in class large }
large is the class, and storage_list is the linked list (actually it's a double-linked list, isn't it...?)
Thanks in advance ;-)