title: Squaring Each element with pointers (C)
body: <p>I am trying to write a C program that squares each element of an array:</p>
  
  <p>Input:</p>
  
  <pre><code> v = {1,2,3}
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code> v = {1,4,9}
  </code></pre>
  
  <p>Here is my C code:</p>
  
  <pre><code> #include &lt;stdio.h&gt;
   #include &lt;math.h&gt;
  
  
   void squaredVector(int *rowVector[] , int arrayLength);
  
   int main(void)
   {
      int result;
      int a[] = {1 , 2 , 3};
      result = squaredVector(&amp;a , 3); /* use the address of array a */
      printf("%d" , result);
      return 0;
   }
  </code></pre>
  
  <p>The function that squares my vector: </p>
  
  <pre><code> void squaredVector(int *rowVector[] , int arrayLength) 
   {
     int i;
     for(i = 0; i &lt; arrayLength; i++)
     {
        *rowVector[i] = (*rowVector[i]) * (*rowVector[i]);
     }
  }
  </code></pre>
  
  <p>I am not really sure what the function is doing, but I assume the values of the array are being passed to the square vector function. I assume that:</p>
  
  <pre><code> *rowVector[i] = (*rowVector[i]) * (*rowVector[i]);
  </code></pre>
  
  <p>is taking element a[i] and squaring it using unmasked pointers</p>