Well, this is an option:
(there's no checking whether index is bigger than the number of elements of the linked list, you can make one easily though)
Code:typedef struct { int data; struct node *next; } node; node *getElementByIndex(node *myList, int index) { node *pos = myList; // pointing to the first element while(index >= 0) { pos = pos->next; --index; } return pos; }