Based on what you have demonstrated for your issues, may I suggest a refresher in C:
Cprogramming C Tutorials
Teach Yourself C in 21 Days
Based on what you have demonstrated for your issues, may I suggest a refresher in C:
Cprogramming C Tutorials
Teach Yourself C in 21 Days
I'm reading specters from stars wich means i need to store an X value for waveleghts and an Y value for radiation flux, the function i'm using is an older program wich get this specters and filter them in specific wavelehghts, it works fine. The new program i made, i did because i needed to automatizate the older so he can do his task with 4000 specters instead of 1 like it's original task.
So it basicalys read the arrays X and Y of each specter and them passes one by one to the older program so he can filter it them, i wanted it to give back to the new program the awnser which is the integral of the filtred specter, the integral also was calculated on the older program.
Did you actually change the code of the original, or are you trying to make "function" your filter? You'll want to make sure you are calling the original code with the data it expects (unwrapping these 4000-long arrays, etc.)
I didn't notice before, but you wrote "Cor = ..." in your original snippet above. That's not going to get you anywhere. You only assign to individual slots of an array.
I changed the code so it should be geting the arrays from the new program like it used to get from the fscanf back when it filtered one specter at time. But i don know if it is geting the arrays because i tried printing from the function and still giving me 0.0 as awnser so its probably no geting the arrays. I know the new program is reading the arrays fine because i tested it before trying to put it togheter with the new.
We don't know either because we don't have any code to work off of. Try to break this down to as simple of an implementation that you can and show us what you have.
My problem is that the way i specified it on the new program aparently isnt enough to pass the arrays Sx[j] and h[j] to the older.
Found my error guys. the Cor parameter was giving 0.0000 because i was trying to print it as %f, changed it to %e and it gave me the right value, thanks for the help!
Frankly I'm amazed it runs at all...Code:#define N 4000 char L[N][1000]; signed char x[N][1000]; float Sx[N], h[N], c[N], Cor[N][4];
These arrays are enormous... over 8 megs of data created on your program's stack.
Your L array alone is 4 megs...
Most programs only have a 1meg stack...
You seriously need to look into using malloc() and free() to create these arrays.