Skip to main content\(\newcommand{\N}{\mathbb N}
\newcommand{\Z}{\mathbb Z}
\newcommand{\Q}{\mathbb Q}
\newcommand{\R}{\mathbb R}
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)
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()!
Activity 26.8.
One last step, free the allocated memory!