first of all u need a proper indentation. this is how it looks when properly indented
Code:
struct Node
{
char name[39];
struct Node *next Ptr;
}typedef struct Node Node;
void insert(Node** firstHndl,char s[])
{
Node*prt malloc(sizeof(char(Node));
strcpy(ptr->name,s);
ptr->nextPtr=*firstHndl;
*firstHndl=ptr;
}
> The bolded code this what I need to understand. how the insertion is made.
this last two line are the one which actually forms the lined list. if u can think of soemthing like follow
Code:
|____|__| -> |_____|__| -> |____|_/_| <-- assume a linked list
^
*firstHndle
|_____|_/_| |_____|__| -> |_____|__| -> |____|_/_|
^
*firstHndle
ptr->nextPtr=*firstHndl;
|_____|__| -> |_____|__| -> |_____|__| -> |____|_/_|
^
*firstHndle
*firstHndl=ptr;
|_____|__| -> |_____|__| -> |_____|__| -> |____|_/_|
^
*firstHndle
if u go thorugh the diagram clearly u will understand what that two statment means
EDIT: Tried my level best to keep the *firstHndle to point to the right node
ssharish2005