Vote count: 0
In pseudo-code, I'd like to replace:
ra = (double *) realloc(ra, Num*sizeof(*ra));
dec = (double *) realloc(dec, Num*sizeof(*dec));
zobs = (double *) realloc(zobs, Num*sizeof(*zobs));
M_B = (double *) realloc(M_B, Num*sizeof(*M_B));
with
e.g. mem_allocate(&ra, &dec, &zobs, &M_B)
where
mem_allocate(arg1, arg2,..., arg4){
for argi in arg1 to arg4{ argi = (double ) realloc(argi, Numsizeof(*argi))
}
}
Many thanks for your help,
Mike
asked 16 secs ago
Succinct dynamic memory allocation in C
Aucun commentaire:
Enregistrer un commentaire