title: Understanding difference/similarities with array and pointers in c++
body: <p>I am trying to understand arrays and pointers in c++. 
  In a past project, I did. I created a pointer and then assigned that pointer to an array of the same type. I've read previous posts, though, that says you can't assign a pointer to an array. Also from the pointer, I was able to use the index to get a certain element (square brackets []). </p>
  
  <p>So I was wondering if anyone could explain to me arrays and pointers in C++ and why something like this is possible, I've tried looking for it online, but haven't found anything.
      Example, </p>
  
  <pre><code>    #include &lt;iostream&gt;
      using namespace std;
  
      int main()
      {
      int *pointer = new int[10];
  
      for (int i = 0; i &lt; 10; i++)
      {
          pointer[i] = i;
      }
  
      for (int i = 0; i &lt; 10; i++)
      {
          cout &lt;&lt; pointer[i];
      }
  
      return 1;
      }
  </code></pre>