Skip to main content

Section 26.5 Dynamic Arrays of Structures: Pentagon

Subsection 26.5.1 Declare Vertices

Activity 26.6.

Use the function createPolygon to create a pentagon (5 vertices) with vertices (0,0), (1,0), (2,1), (1,3), (0,1).

Subsection 26.5.2 Print Pentagon

Activity 26.7.

Finally... Write a function printPoly() to which you pass a polygon and a number (its number of vertices), and which prints out these vertices.

Subsection 26.5.3 Don’t forget to free()!