Problem statement: Given a position, delete the number at that position in the linked list.

 Iterative Solution 1) Find the previous position that is to be deleted by traversing till the position. 2) Assign the next of the previous node. 3) Free(temp).

Here we should keep in mind that the position given should be less than the length of the linked list.
As linked list starting position or index is 0. The position can be greater than or equal to 0 and less than the length of the LinkedList.

 Constraints position < length of LinkedList 0 <= position < length of LinkedList
```/*C code to delete an node at a position from the Linked List */
#include <stdio.h>
#include <stdlib.h>

typedef struct node
{
int data;
struct node *next;
} NODE;

NODE *newNode(int key)
{
NODE *temp = (NODE *)malloc(sizeof(NODE));
temp->data = key;
temp->next = NULL;
return temp;
}

{
if (temp == NULL)
{
return 0;
}
int count = 0;
while (temp != NULL)
{
count++;
temp = temp->next;
}
return count;
}

NODE *deleteNode(NODE *head, int pos, int len)
{
if (pos == 0)
{
}
if (pos > len)
{
printf("Position=%d should be less than length=%d of linkedlist!\n", pos, len);
}

for (int i = 0; i < pos; i++)
{
prev = temp;
temp = temp->next;
}
prev->next = temp->next;
printf("Node from %d position is deleted!\n", pos);
free(temp);
}

void printList()
{
if (temp == NULL)
{
printf("List is empty!\n");
return;
}
while (temp != NULL)
{
printf("%d--> ", temp->data);
temp = temp->next;
}
printf("NULL\n");
}

int main()
{
printList();
int pos = 0;
printf("Enter the position to delete\t");
scanf("%d", &pos);