title: How to declare a dynamic integer array in ANSI - C using malloc and put input integers into it?
body: <p>First I want the user to input what is the size of the desired array.
  So I am using:</p>
  
  <pre><code>int size;
  scanf("&amp;d",&amp;size);
  </code></pre>
  
  <p>Now I want to create an integer array using a pointer and the malloc function.
  This is what I did:</p>
  
  <pre><code>int *p1 = (int*)malloc(sizeof(int)*size);
  </code></pre>
  
  <p>According to my understanding, this is like using:</p>
  
  <pre><code>int p1[size];
  </code></pre>
  
  <p>But how do I use it like an array?</p>
  
  <p><strong>Question</strong> 1:
  Now I want the user to input as many integers as he wrote into this "array".
  But I can't use p[0] because it is not an array, it is a pointer.</p>
  
  <p><strong>Question</strong> 2:
  I want to "send" this array to a function that gets an array of integers.
  So again, this is not an array, how can I "give" it to the function?</p>