Created
August 3, 2019 20:34
-
-
Save heronyang/f5445d7f147bef0a8612397cbdebc3c2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* labeledPoint.c */ | |
| #include "labeledPoint.h" | |
| #include <stdlib.h> | |
| struct LabeledPoint { | |
| double x, y; | |
| char* name; | |
| }; | |
| struct LabeledPoint* makeLabeledPoint(double x, double y, char* label) { | |
| struct LabeledPoint* p = malloc(sizeof(struct LabeledPoint)); | |
| p->x = x; | |
| p->y = y; | |
| p->name = name; | |
| return p; | |
| } | |
| void setLabel(struct LabeledPoint* lp) { | |
| lp->name = name; | |
| } | |
| char* getLabel(struct LabeledPoint* lp) { | |
| return lp->name; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment