Thanks in advance to anyone/everyone who can help. I've written a code (see below) that works for small test values of N and M, say N = 50 and M = 30. However, I run into problems when I try to use large values of N = 401450280 and M = 32768. I can compile the code, but when I run it, I get a "bus error" that appears to be caused by the malloc line in function help.
See snippets below:
See snippets below:
Code:
struct coords{
float *length;
};
void combos(struct coords *events, int M);
float help(struct coords *events, int M);
void main(){
int N = 50;
int M = 30;
struct coords *events;
events = malloc(N*sizeof(*events));
combos(events, M);
}
void combos(struct coords *events, int M){
help(combos, M);
}
float help(struct coords *events, int M){
events->length = malloc(M*sizeof(float));
/* code follows to assign floats to every element of array length */
}
Comment