Пример #1
0
int main() {
    double x, y;
    printf("Enter coordinates of point A: ");
    scanf("%lf %lf", &x, &y);
    Point* a = make_point(x, y);

    printf("Enter coordinates of point B: ");
    scanf("%lf %lf", &x, &y);
    Point* b = make_point(x, y);

    Point* c = compute_mid(a, b);

    print_point(c);

    destroy_point(a);
    destroy_point(b);
    destroy_point(c);

    return 0;
}
Пример #2
0
// free the memory for stroke object including its children objects such as points
PtrStroke destroy_stroke (PtrStroke stroke)
{
    PtrInkPoint point = NULL;
    PtrStroke nextStroke = NULL;
    if (stroke == NULL)
        return NULL;
    nextStroke = stroke->nextStroke;
    point = stroke->firstPoint;
    while (point)
        point = destroy_point (point);

    SB_INKPRINTF("return(%p)\n", stroke);
    free (stroke);
    return nextStroke;
}