I am trying to write a program that counts how many points are within the radius of a circle. The user chooses the x and y coordinates of the center of the circle, the radius of the circle, the x and y coordinates of the points, and the program responds with how many of those points are in the circle. This is what I've tried, but it only counts the total number of points. Can't figure out what I'm doing wrong!

Code:

typedef struct {
float x, y;
} Point;
/* PointListNode -- A node of a singly-linked list of points */
typedef struct PointListNode{
Point *p;
struct PointListNode *next;
} PointListNode;
int count_nearby_points(PointListNode *pointList, Point* centrePoint, float radius){
PointListNode* current = pointList;
float xDistance, yDistance, length;
int count=0;
while (current != NULL){
xDistance = (pointList->p->x) - (centrePoint->x) ;
yDistance = (pointList->p->y) - (centrePoint->y) ;
length = sqrt((xDistance*xDistance)+(yDistance*yDistance));
if(length <= radius){
count++;
}
current = current->next;
}return count;
} /* count_nearby_points */