-
gcc 4.1.2 for i386-redhat-linux
What I really should have been doing all along, as laserlight eventually points out in another thread, was this
Code:
struct thestruct {
[...]
} *ray;
int main () {
short int nofl, i;
[...determine nofl]
ray = malloc(nofl * sizeof(*ray));
for (i=0; i<nofl; i++) {
ray[i].member = whatever;
}
Sorry for wasting so much time...like I said, bullheaded and new to C. But I did pick up some stuff along the way.
-
Incidentally, must ray really be a global variable? If feasible, make it a local variable. Also, remember to free() what you malloc(), and to check that malloc() does not return NULL before using ray as a dynamically allocated array.