n = sizeof(p) / sizeof(struct data);
q = malloc(sizeof(struct data) * n); // 何でこんなことしてんの?
// q = malloc(sizeof(p)); // で良いんじゃね?