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
Get step-by-step solutions from verified subject matter experts
