title: Multiply each element of an array by a number in C
body: <p>I'm trying to optimize some of my code in C, which is a lot bigger than the snippet below. Coming from Python, I wonder whether you can simply multiply an entire array by a number like I do below. </p>
  
  <p>Evidently, it does not work the way I do it below. Is there any other way that achieves the same thing, or do I have to step through the entire array as in the for loop?</p>
  
  <pre><code>void main()
  {
      int i;
      float data[] = {1.,2.,3.,4.,5.};
  
      //this fails
      data *= 5.0;
  
      //this works
      for(i = 0; i &lt; 5; i++) data[i] *= 5.0;
  
  }
  </code></pre>