title: Having issues with element assignment using TYPE
body: <p>I am attempting to utilize <code>TYPE</code> for a generic array and don't seem to be getting the syntax quite right. I can get the code to work using <code>int</code>, but when I convert to <code>TYPE</code> the statement assigning values stops working. </p>
  
  <p>Here is my Array creation:</p>
  
  <pre><code>struct DynArr
  {
      TYPE *data;     /* pointer to the data array */
      int size;       /* Number of elements in the array */
      int capacity;   /* capacity ofthe array */
  };
  
  
  void initDynArr(DynArr *v, int capacity)
  {
      assert(capacity &gt; 0);
      assert(v!= 0);
      v-&gt;data = (TYPE *) malloc(sizeof(TYPE) * capacity);
      assert(v-&gt;data != 0);
      v-&gt;size = 0;
      v-&gt;capacity = capacity;
  }
  
  
  DynArr* createDynArr(int cap)
  {
      assert(cap &gt; 0);
      DynArr *r = (DynArr *)malloc(sizeof( DynArr));
      assert(r != 0);
      initDynArr(r,cap);
      return r;
  }
  </code></pre>
  
  <p>And here is my call to modify:</p>
  
  <pre><code>void addDynArr(DynArr *v, TYPE val)
  {    
      /* Add Element */
      *v-&gt;data = val;
      v-&gt;size++;    
  }
  </code></pre>
  
  <p>The code is compiling, but <code>val</code> is not being assigned to the <code>data</code> fields.</p>
  
  <p><strong>Edit</strong>: In my test case I am passing <code>TYPE</code> as a <code>double</code>.</p>
  
  <p>Test Function calls:</p>
  
  <pre><code>addDynArr(dyn, 3);
  addDynArr(dyn, 4);
  </code></pre>
  
  <p>When Running the following val is reporting as 0:</p>
  
  <pre><code>printf("Val: %d ", val)
      /* Add Element */
      v-&gt;data[v-&gt;size] = val;
      v-&gt;size++;
  </code></pre>