C the Heap using in Fuctions still not clear : <p>I'm still confused about the errors that I get while compiling to solve my code. I tried to make two simple functions. One that initialize an array and put 0 in every index and the other that prints that function out.</p>

<p>Following code:</p>

<pre class="lang-c prettyprint-override"><code>#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;

int arraybuilder(int len)
{
    int *array;
    array = (int*) malloc(len * sizeof(int));

    for(int i = 0; i&lt;len; i++)
    {
        array[i] = 0;
    }

    free(array);
    return array;
}

void printarray(int array[], int len)
{
    for(int i = 0; i &lt; len; i++)
    {
        printf("array[%d] = %d\n", i, array[i]);
    }
}



int main(int argc, char* argv[]) 
{
    int len = 100;
    int *array = arraybuilder(len);

    printarray(array, len);

    return 0;

}
</code></pre>

<p>></p>

<blockquote>
  <p>malloctest.c: In function ‘arraybuilder’:
  malloctest.c:15:9: warning: return makes integer from pointer without a cast [-Wint-conversion]
    return array;
           ^</p>
</blockquote>

<p>And:</p>

<blockquote>
  <p>malloctest.c: In function ‘main’:
  malloctest.c:31:15: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
    int *array = arraybuilder(len);</p>
</blockquote>

<p>Thank you in advance for the help :)</p>
