Check out example codes for "fast and slow pointer approach to find the middle of the linked list". It will help you in understanding the concepts better.

Code Example 1

struct node* findMiddle(struct node* head){
  if(head == NULL)exit(1);
  struct node* slow;
  struct node* fast;
  fast = slow = head;
  while(fast -> next != NULL && fast != NULL && fast -> next -> next != NULL){
    slow = slow -> next;
    fast = fast -> next -> next;
  }
  return slow;
} 

Learn ReactJs, React Native from akashmittal.com