Where do the other frequencies come from?

I wrote a c program which creates a wave file with a 1khz sine.
It looks ok in Audacity but when I switch to the spectrogram I can see that there are many other frequencies too…
I attached the wave file.
If I use Audacity’s generate function and I generate a 1khz sine with 10 secs and 1 as amplitude it looks the same in the waveform view. The only difference is in the spectrogram.

But why is there a difference?
Does Audacity show all points in the waveformview if I zoom in?

I appreciate any help.

Because Audacity’s generated waveform is more accurate.
Your sample values appear to be accurate to about 2 decimal places (8-bit?), whereas Audacity’s samples are accurate to more than 10 decimal places (32-bit float).

Thanks I changed my precision. WORKS NOW!!!
:happy: