GUSANO *init_g(int x, int y, int dir, int largo) { GUSANO *g; POINT *p; int i; g = (GUSANO *)malloc(sizeof(GUSANO)); g->dir = dir; g->growth = 0; g->cuerpo = init_l(); p = (POINT *)malloc(sizeof(POINT)); p->x = x; p->y = y; add_l(g->cuerpo, p); tablero[x/GORDO][y/GORDO] = create_obj_w(x, y, GORDO, "oval", "red"); for(i=1; i<largo; i++) { x = x + GORDO; p = (POINT *)malloc(sizeof(POINT)); p->x = x; p->y = y; add_l(g->cuerpo, p); tablero[x/GORDO][y/GORDO] = create_obj_w(x, y, GORDO, "oval", "red"); } return g; }
main() { struct lista *l; int k; clrscr(); l=init_l(l); printf(" \n \n LISTA INITIALA : "); tipar(l); printf(" \n \n CHEIA DE ELIMINAT:"); scanf("%d",&k); l=elim_l(l,k); printf(" \n \n NOUA LISTA ESTE : "); tipar(l); getch(); }