can someone please explain me the concept of double pointers refering to the following code or any other code that you think might help me clear my concept for double pointers.
Code:
struct Node
{
int value;
struct Node*Next;
};
case 1:
printf("\nEnter the number to insert:\n");
scanf("%d",&val);
insert (&start, val);
break;
case 2:
remove2(&start);
break;
void insert (struct Node**start, int v)
{
if (*start == NULL)
{
*start = (struct Node*) malloc(sizeof(struct Node));
(*start)-> value = v;
(*start)-> Next = NULL;
}
else{
struct Node*temp = *start;
while ((temp-> Next) != NULL)
{
temp = temp->Next;
}
temp->Next= (struct Node*) malloc (sizeof(struct Node));
temp = temp-> Next;
temp->value= v;
temp-> Next = NULL;
}
}
void remove2 (struct Node**start)
{
if( *start == NULL)
{
printf("\nThe List is Empty\n");
}
else
{
struct Node*temp= *start;
while ((temp->Next->Next) != NULL)
{
temp = temp->Next;
}
temp->Next = NULL;
}
}