Finding the middle element in a linked list using double pointer method
===

I wrote the following function which returns the middle element of a linked list, which uses the double pointer method

    struct node
    {
    int data;
    struct node *next;
    }*start;

    void middleelement()
    {
    struct node *x=start,*y=start;
    int n=0;

    if(start==NULL)
    {
        printf("\nThere are no elments in the list");
    }

    else
    {
        while((x->next)!=NULL)
        {
            x=x->next->next;
            y=y->next;
            n++;
        }

        printf("\nMiddle element is %d",y->data);
    }
    }

However, whenever i run the functions, the **Windows explorer stops working**
What is the flaw in the code ?
Is there any better algorithm than this to find the middle element ?
 