Write a function that determines if two Points
are equal.
Two Points are equal if their X coordinate is the
same and their Y coordinate is the same.
/* declare the Point type */
typedef struct
{
int x, y;
} Point;
/* function to print a Point */
void printPoint( Point *p )
{
printf("(%d, %d) ", p->x, p->y );
}
/* are two Points equal? */
int equalPoint( Point *ptA, Point *ptB )
{
. . .
}
int main()
{
Point p1 = { 23, 45 };
Point p2 = { 23, 45 };
Point p3 = { 86, 99 };
if ( equalPoint( &p1, &p2 ) )
printf("Equal: " );
else
printf("Not Equal: ");
printPoint( &p1 );
printf("\t");
printPoint( &p2 );
printf("\n");
if ( equalPoint( &p1, &p3 ) )
printf("Equal: " );
else
printf("Not Equal: " );
printPoint( &p1 );
printf("\t");
printPoint( &p3 );
printf("\n");
return 0;
}