Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22148

How to implement std::accumulate in C [closed]

$
0
0

I need the functionality of the std::accumulate function from the C++ "numeric" library but I am working in C. I still have a rudimentary understanding of the differences in the c/c++ compilers, so I don't know if it's possible to implement this feature in a c file. I am hoping for a similar, fast and effective way to sum the items in a buffer, because I am writing a DMA buffer (I will be reading ADC values in), and need to pull the sum of a buffer when it fills up and calls the callback for the interrupt.

Basically I need a C function to return the sum of everything from Buffer to Buffer + BufferLength.

Thanks!


Viewing all articles
Browse latest Browse all 22148

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>