How to extract the maxima and minima of a noisy period input signal
If you have the entire signal, you can then run a Lowess smoothing. This algorithm is statistically robust and provides locally acceptable smoothing. Outliers will be tolerated as well. After smoothing your signal in that way, you might apply a derivative based (or even derivative free) peak detection in order to obtain the signal peaks. These will be your local minima/maxima.

You could use MATLAB or R and port smoothing algorithms to C, they are pretty straightforward and open source:

http://www.mathworks.com/help/curvefit/smooth.html

And here are your options in C:

1) https://code.google.com/p/variationtoolkit/ for Lowess/Loess.
2) For peak detection, there are many tools available in C, one of them being:

https://github.com/xuphys/peakdetect