Question: -----------C------C---------C-------C------------C-------------C------------ Question 4 (40 Points) Please create a triangle structure that contains the edge lengths of a triangle as integers. Hint: You can create a
-----------C------C---------C-------C------------C-------------C------------
Question 4 (40 Points) Please create a triangle structure that contains the edge lengths of a triangle as integers. Hint: You can create a struct for your triangles as follows: struct triangle { int a; int b; intc; }; typedef struct triangle triangle; Take an integer n from the user that represents the number of triangles and allocate dynamic memory for your triangles. Hint: You can allocate memory for your triangles as follows: triangle *tri= malloc(n * sizeof(triangle)); Assign random numbers for the lengths of edges of the triangles. Your triangles must satisfy the following constraints: 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
