title: How to increment a for loop with a decimal value in C
body: <p>I have this code</p>
  
  <pre><code>for (k=0; k&lt;BUFFER_LEN; k++){                
  
             buffer[k] = sin(2*pi*f/fs*k);          //sine generation
  </code></pre>
  
  <p>my loop increments by 1 each time - so k will be 1, 2, 3, 4, 5.... etc for each calculation</p>
  
  <p>I would like the loop to increment by 0.1 each time for example, so my sine calculation is more accurate?
  What would be the simplest way to achieve this? I tried incrementing by 0.1 in that for loop but  dont think this is allowed as the program times out</p>
  
  <p>edit: here is a solution</p>
  
  <pre><code>int i, k;
  float z=0.1;
  
  for(i = 0; i &lt; BUFFER_LEN; i++){                         // fill the buffer
         buffer[k] = sin(2*pi*f/fs*z);                     // sine wave value generation
         z = z + 0.1;
         }
  </code></pre>