If a triangle is a right triangle (if it has a 90 degree angle) then the square of one side of the triangle is equal to the sum of squares of other two sides. Of course, it is not clear which role the various sides of our triangle play, so all possiblilities have to be tested.
Say that point A = (Xa,Ya) and point B = (Xb,Yb). Then the squared distance between the two points is (Xa-Xb)2 + (Ya-Yb)2. Calculate the squared distance between all three pairs of points and add them in various combinations to determine if the triangle is a right triangle.
/* declare the Triangle type */ void setTriangle( Triangle *t, Point p0, Point p1, Point p2, Color c ) {...} int isRightTriangle( Triangle *t ) {...} int main() { /* declare and initialize Points and a Color */ Point p0={0,0}, p1={4, 0}, p2={4, 3}; Point p3={100,50}, p4={500, 350}, p5={212, 434}; Color c={100, 100, 100}; /* declare and initialize a Triangle */ Triangle tri; setTriangle( &tri, p0, p1, p2, c ); printTriangle( &tri ); /* Is is Right? */ if ( isRightTriangle( &tri) ) printf("Right Triangle\n"); else printf("Ordinary Triangle\n"); /* declare and initialize a Triangle */ setTriangle( &tri, p3, p4, p5, c ); printTriangle( &tri ); /* Is is Right? */ if ( isRightTriangle( &tri) ) printf("Right Triangle\n"); else printf("Ordinary Triangle\n"); return 0; }