void Nth_Node_End(No de First, int N)
{
Node Cur_Node, N_node;
Cur_Node = First;
N_node = First;
while(Cur_Node)
{
for(i = 0; i < N; i++)
{
Cur_Node = Cur_Node->Next;
}
if(Cur_Node == NULL)
break;
else
{
Cur_Node = N_node->Next;
N_node = N_node->Next;
}
}
Printf("The Nth node is %x and its value = %d\n", N_node,N_node->Value);
}
Assuming the Linked list is not empty
{
Node Cur_Node, N_node;
Cur_Node = First;
N_node = First;
while(Cur_Node)
{
for(i = 0; i < N; i++)
{
Cur_Node = Cur_Node->Next;
}
if(Cur_Node == NULL)
break;
else
{
Cur_Node = N_node->Next;
N_node = N_node->Next;
}
}
Printf("The Nth node is %x and its value = %d\n", N_node,N_node->Value);
}
Assuming the Linked list is not empty
Comment