So you have your struct.
In main you can declare a point.
struct Point point1;
struct Point point2;
Now you made a struct variable called point that has access to both of those values double x and double y in your struct.
point1.x = 12;
point1.y = 15;
point2.x = 5;
point2.y = 6;
To pass it into the function you pass in a pointer to the struct, that lets you edit the value of that point.
//function call
double value = geometricDistance(&point1, &point2);
double geometricDistance(struct Point* point1, struct Point* point2)
{
double xDist = point1->x - point2->x;
double yDist = point1->y - point2->y;
return sqrt((xDist * xDist) + (yDist * yDist));
}
Edit: I realized that you don't actually need to pass in the pointer to the struct. you can simply make the function parameters double geometricDistance(struct Point point1, struct Point point2)
since you're not changing the values of any of the struct variables you declared.
Your function call could simply be double value = geometricDistance(point1, point2);
Inside of the function instead of using the ->
reference you can use the .
reference like this point1.x
or point1.y