I have a struct declared like this:
What I want to do now is to Add the 10 graphs to give me the sum in TotalGraph. The problem is however that not all the x-values are the same (but they are ordered from low to high), so you can not simply add the corresponding y-values. At the moment I put all the values in a large array, sort them using qsort, and then use the difference between two subsequent y-values to determine the total y-value at each discrete x-value. Although this works well enough, it's not fast enough.