title: Address boundary error on dynamic array
body: <p>I'm just starting with <code>C</code> from a interpreted language background, and I'm having problems understanding why this is not working.</p>
  
  <p>I have a <code>Dynamic_Array</code> struct (<a href="http://pastebin.com/h4k7Sk3U" rel="nofollow">http://pastebin.com/h4k7Sk3U</a>), and a <code>Task</code> struct (<a href="http://pastebin.com/evs4TEQA" rel="nofollow">http://pastebin.com/evs4TEQA</a>).</p>
  
  <p>When creating a <code>Dynamic_Array</code> instance with an initial size I get:</p>
  
  <pre><code>“./ctask ” terminated by signal SIGSEGV (Address boundary error)
  </code></pre>
  
  <p>I tracked the error with <code>gdb</code>, who shows that its originated on <code>dynamic_array.h:16</code>:</p>
  
  <pre><code>Dynamic_Array *dynamic_array_create(size_t initialSize) {
    Dynamic_Array *a;
    a-&gt;array = (Task *)malloc(initialSize * sizeof(Task));   // line 16
    a-&gt;used = 0;
    a-&gt;size = initialSize;
    return a;
  }
  </code></pre>
  
  <p>What am I doing wrong there? I'm multiplying the initial size with the size of the <code>Task</code> struct, which is supposed to be enough memory for them.</p>