Question
typedef struct _coord { float x; float y; struct _coord *next; } coord; typedef struct { coord *head; char *name; } polygon; /* * Allocates
typedef struct _coord {
float x;
float y;
struct _coord *next;
} coord;
typedef struct {
coord *head;
char *name;
} polygon;
/*
* Allocates space for polygon struct, and for the name
* Copies the name into the polygon struct
* Returns a pointer to the new polygon.
*
* NOTE: use strlcpy instead of strcpy
*/
polygon *init_polygon(char *name){
//YOUR CODE HERE
return NULL;
}
/*
* Initializes a coordinate struct. Called by push(..)
* Allocates the struct
* Assigns x and y
* The next pointer is initializes to NULL
* Return a pointer to the newly-initialized struct.
*/
coord *init_coord(float x, float y) {
//YOUR CODE HERE
return NULL;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started