How can I generate a sine wave with time varying frequency that is continuous, in C?
Well lets go lol

@AnonSubmitter85 give to you a nice answer, but let me show my  way to do it in matlab, and this maybe can be very easy to port to C:

First I'm creating 256 samples in 500hz sampled at 44100hz take a look how I accumulate the phase and in the end of the first loop I put the phase between the interval 0 and 2pi...

Nice now lets go to the second loop to create more 256 samples of 1000Hz and to do it continuous I'm using the last phase :-), here is the code:

m_phase=0;

signal=[];

f=500;
fs=44100

phaseInc = 2*pi*f/fs;


for i=1:256
   signal(i) = sin(m_phase);
   m_phase = m_phase + phaseInc;
 end

%place the phaser between the 0 and 2pi range
m_phase = mod(m_phase, 2*pi);


f=1000
phaseInc = 2*pi*f/fs;


for i=257:256*2
   signal(i) = sin(m_phase);
   m_phase = m_phase + phaseInc;
end

%place the phaser between the 0 and 2pi range
m_phase = mod(m_phase, 2*pi);


here is the plot of the above code::