title: Program not loading array correctly
body: <p>Question at hand: Write a function primeTableInRange to generate a table to show whether each number in the range from startNum up to endNum is a prime number.  When the number is not a prime number, we will only show a ‘*’. When the number is a prime number, we will  show the number.</p>
  
  <p>My code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;ctime&gt;
  #include &lt;cmath&gt;
  #include &lt;cstdlib&gt;
  
  
  using namespace std;
  
  int primetableinarray(int userarray[], int arraysize);
  
  int main()
  {
  int startNum, endNum;
  cout&lt;&lt; "Enter your first number in the range" &lt;&lt; endl;
  cin&gt;&gt;startNum;
  cout&lt;&lt; "Enter your last number in the range" &lt;&lt; endl;
  cin&gt;&gt;endNum;
  
  int arraysize = endNum - startNum;
  int userarray[arraysize];
  for (int i=startNum;i&lt;=endNum;i++)
  userarray[i]= startNum++;
  primetableinarray(userarray, arraysize);
  return 0;
  }
  
  int primetableinarray(int userarray[], int arraysize)
  {
  
  for (int i=2;i&lt;arraysize;i++)
  {
  bool prime=true;
  for (int r=2;r*r&lt;i;r++)
  {
      if (i % r ==0)
      {
          prime=false;
          break;
      }
  }
  if(prime) cout &lt;&lt; i &lt;&lt; endl;
  
  else
      if(true) cout&lt;&lt; "*" &lt;&lt; endl;
  }
  }
  </code></pre>
  
  <p>Issue is it doesn't start at "startNum" and doesn't end at "endNum". It actually goes from 0 to arraysize. Also it calculates 4 as a prime number. What am I missing here?</p>