Definition:
The calling:Code:int rr_counts(struct DataList* ArrayOne, size_t SizeOfArrayOne, struct DataList* ArrayTwo, size_t SizeOfArrayTwo)
Code:rr_counts(my_array1, sizeof(my_array1), my_array2, sizeof(my_array2));
I don't know what is the job of
rr_counts(xx_r,yy_r,zz_r,nrows2,nrows3,rad);
What you can do, I suppose is:
Code:void third_read_file(long double *rad, int *nrows3) { some code . . . *nrows3=something; rad=(long double *)malloc(sizeof(long double) * *nrows3); } void rr_counts(struct DataList *data_list_d,long double *rad, int nrows3) { // here xx_r[i] = data_list->data[i].x // here yy_r[i] = data_list->data[i].y // here zz_r[i] = data_list->data[i].z // here nrows2 = data_list->size } int main(void) { struct DataList data_list_d, data_list_r; int nrows3; long double *rad; if (readFile("file1", &data_list_d)) { printf("there are %d in FIRST data\n", data_list_d.size); free(data_list_d.data); } if (readFile("file2.dat", &data_list_r)) { printf("there are %d in random data\n", data_list_r.size); free(data_list_r.data); } /* The old rr_count rr_counts(xx_r,yy_r,zz_r,nrows2,nrows3,rad); */ /* The code for the third file read is left as an exercise for the reader. */ third_read_file(rad,&nrows3); rr_counts(data_list,rad,nrows3); return 0; }
I got it sorted -
so what i did was (for anyone as inept as me):
for the function rr_counts:
then when called the function in int main:Code:int rr_counts(struct DataList data_list_r) { for(j=0; j<51; j++) { printf("rr test= %Le\n",data_list_r.data[j].x); } . . . }
as easy as that!Code:rr_counts(data_list_r);
in your function prototype and implementation (the working parts of the function) you have to list the data types and appropriate names for them, in the function call you have to just write the names of types to pass that match the types declared in the prototype, the number of parameters you pass must also match prototype, you only need to declare variables local to the function if u think u need them to perform operations in the function
Thought for the day:FLTK: "The most fun you can have with your clothes on.""Are you sure your sanity chip is fully screwed in sir?" (Kryten)
Stroustrup:
"If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"