I'm new to programming so please bear with me. Can anyone please explain what the last line of code is doing and what this entire block of code trying to do. I know the first block is creating a structure called node and adding two pointers *next and *prev to it. btw this is a part of a linked list program
struct node
{
char line[80];
struct node *next,*prev;
};
struct node *start=NULL,*temp,*temp1,*temp2,*newnode;
Thank you in advance.
struct node *start=NULL,*temp,*temp1,*temp2,*newnode;
can be as
struct node *start=NULL;
struct node *temp;
struct node *temp1;
struct node *temp2;
struct node *newnode;
Now is it easy to understand..?
The last line is creating 5 pointers of type struct node
namely start
which is pointing to NULL
, temp
, temp1
, temp2
and newnode
.
The whole block of code is actually creating a struct called node
which contains an array of 80 characters, followed by pointers to next and previous. Hence it is creating a structure for a doubly linked list.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With