Can someone explain this part to me?
1.
double_llist()
{
start = NULL;
}
what does it do? why it doesn't start with void?
2.
double_llist dl;
What does this do in main? what is d1?
3.
What does pointer start do in this code? is it head?
1) this is the class constructor.
think,
int x = 3;
this creates a new integer, and assigns it a value of 3. If int were a class, it would be calling a constructor to do that.
It does not have a type, because c++ syntax. Google "why constructor has no return type in c++" for in-depth reasons, or just know it is a feature of the language. This constructor for your list class (or, apparently, someone else's list class) sets the start pointer to null.
2) you are creating a variable of the class type, much like my int x above, here dl is analogous to x, dl is a variable that you can use. the class itself cannot be used; it is a type, just as you cannot use int standalone as an integer but you make a variable of that type.
1)
the start is NULL because all variables are created with garbage values at start so we are initia;izing
(NULL means pointing nowhere)
void is a datatype,its not a value.
NULL is #define NULL 0,that means it points to nothing
2)
in order to use functions of a class unless they are a
static function of the class we cannot call a function
without the object hence we are creating an object of double_llist
The loop at lines 135 and 136 moves s down until it points to the last item in the list. This is a little odd since you'd expect a method called create_list() to make a new list. This create_list() method really adds the value to the end of the list. It would be more appropriately named add_end() to match the add_begin() method.
It's also odd that start is a global variable and not a member of the list. That means the class can only support a single list. Even when there are multiple instances of the class, they all refer to the same list because they all use the same start pointer.