Can anyone help me where I'm going wrong please !!!, I'm a beginner to programming, I'm new to DSA, I'm not able to find my mistake, here is the code please go through it:

> 
> This is the outline of my question, hope it is clear! :)
> 
> 
> 

```

sample input : 3 16 13 7 1 2
3 is the number of elements to input into a linked list
so 16 13 7 are elements of the linked list initially
1 is the element I'm interested to insert
2 is the position where I want to insert the element 1
so the expected output will be:
sample output: 16 13 1 7

```

> 
> The problem I'm facing :
> 
> 
> 

```

The output I'm getting is: 13 1 7
So the problem is not every element in the list is getting returned, please help !!!

```

> 
> This is the code I tried, any suggestions are encouraged, :)
> 
> 
> 

```
   struct SinglyLinkedListNode 
  {
        int data;
        SinglyLinkedListNode* next;
  };

    SinglyLinkedListNode* insertNodeAtPosition(SinglyLinkedListNode* head, int data, int position) 
{
    int i = 0;
    SinglyLinkedListNode *pcurr, *pnew;

    pnew = (SinglyLinkedListNode*)malloc(sizeof(SinglyLinkedListNode));
    if(position == 0)
    {
        pnew->data = data;
        pnew->next = head->next;
        head = pnew;
        return head;
    }
    if(head == NULL)
    {
        pnew ->data = data;
        return pnew;
    }
    else
    {
        do 
        {
            pcurr = head;
            pcurr = pcurr->next;
            head = head->next;
            i++;
        }
        while (i != position-1);
        pnew->next = pcurr->next;
        pnew->data = data;
        pcurr->next = pnew;
        return head;
    }
}

```

I would be glad if anyone suggests a good visualising platform for viewing our code line by line especially for c , just like in python.