title: Error in using vector pointer in a function
body: <p>I have this code, but it won't compile and i can't understand what is wrong - i guess the pointering of the vector is not correct. 
  My idea was to collect some numbers in main() and store them in a vector and array, and then pass the memory address of them to a function, and using a pointers to print the data stored.</p>
  
  <p>I came up with this when i read something about pointers which said that i should use them in order to save memory, so IMO the code below will not copy the contents of the vector and the array but use a pointer to access their location in memory - that's what i want to do.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  using namespace std;
  
  void function(vector&lt;int&gt;* a, int *s)
  {
      cout &lt;&lt; "function starts.." &lt;&lt; endl;
      for(int i=0;i&lt;a-&gt;size();i++)
      {
          cout &lt;&lt; a[i] &lt;&lt; endl;
          cout &lt;&lt; s[a[i]] &lt;&lt; endl;
      }
      cout &lt;&lt; "function ends..." &lt;&lt; endl;
  }
  
  
  int main(void)
  {
      vector&lt;int&gt; m;
      int s[102];
      for(int i=0;i&lt;10;i++)
      {
          m.push_back(i*i);
          s[i*i] = i-2;
      }
      function(&amp;m, &amp;s);
      return 0;
  }
  </code></pre>
  
  <p>I receive several errors on compiling, something is wrong.</p>
  
  <p>Please tell me what's wrong with my code and how to fix it. thank you...</p>