All pastes #815026 Raw Edit

Someone

public c v1 · immutable
·published 2007-12-13 18:52 UTC
rendered paste body
typedef struct bul {    float x, y;    float direction;    float velocity;	int type;    struct bul *next;} bullet;[...]bullet *head = NULL;main(){[...]bulletsUpdate(&head);[...]}[...]void bulletRemove(bullet **p) /* remove head */{    if (*p != NULL) {        bullet *n = *p;        *p = (*p)->next;        free(n);    }}void bulletsUpdate(bullet **n){	if ((*n) == NULL) return;	while ((*n) != NULL) {		(*n)->y -= (*n)->velocity;		if ((*n)->y > 1000 || (*n)->y < -1000) bulletRemove(n);		(*n) = (*n)->next;	}}