title: returning an array of vectors in C++
body: <p>I'm having difficulty returning an array of string vectors. I have a function:</p>
  
  <pre><code>std::vector&lt;std::string&gt;* generatecVec(std::vector&lt;std::string&gt; strVec){
    std::vector&lt;std::string&gt; cVec[3];
    cVec[0].push_back("Test11");
    cVec[0].push_back("Test12");
    cVec[0].push_back("Test13");
    cVec[1].push_back("Test21");
    cVec[1].push_back("Test22");
    cVec[1].push_back("Test23");
    cVec[2].push_back("Test31");
    cVec[2].push_back("Test32");
    cVec[2].push_back("Test33");
    return cVec;
  }
  </code></pre>
  
  <p>and later I use the function like </p>
  
  <pre><code>std::vector&lt;std::string&gt; *cVec = generatecVec(strVec);
  for(std::vector&lt;string&gt;::iterator it = cVec[0].begin(); it != cVec[0].end(); ++it) {
      std::cout &lt;&lt; *it;
  }
  </code></pre>
  
  <p>but I keep getting segmentation fault. I realize I must be using pointers improperly, but how might I fix this? I use the array of vectors because it is very easy to refer to it by index (I only need three, non dynamic). Thanks!</p>