title: Core segmentation on .so library in C++
body: <p>The program works fine until you use a determinated size for the array called tsp ,then it gives a segmentation fault.</p>
  
  <pre><code>std::cout&lt;&lt;"point1"&lt;&lt;std::endl;
  vector&lt; pair&lt; int, float &gt; &gt; valores ;
  std::cout&lt;&lt;"point2"&lt;&lt;std::endl;
  cargar_vector_valores(valores, defenses); 
  std::cout&lt;&lt;"point3"&lt;&lt;std::endl;             
  unsigned int cost = 0;
  std::cout&lt;&lt;"point4"&lt;&lt;std::endl;
  //copiar lista de defenses a vector
  vector&lt;Defense*&gt; copia_defenses;
  std::cout&lt;&lt;"point5"&lt;&lt;std::endl;
  for(std::list&lt;Defense*&gt;::iterator it=++defenses.begin();it != defenses.end();it++){
      copia_defenses.push_back((*it));
  }
  std::cout&lt;&lt;"point6"&lt;&lt;std::endl;
  std::cout&lt;&lt;"defenses.size()-1="&lt;&lt;defenses.size()-1&lt;&lt;std::endl;
  std::cout&lt;&lt;"cols = "&lt;&lt;ases+1&lt;&lt;std::endl;
  int rows=defenses.size()-1;
  int cols=ases+1;
  int tsp [rows][cols];
  std::cout&lt;&lt;"point7"&lt;&lt;std::endl;
  selectedIDs.push_back((*defenses.begin())-&gt;id);
  std::cout&lt;&lt;"point8"&lt;&lt;std::endl;
  ases-=(*defenses.begin())-&gt;cost;
  std::cout&lt;&lt;"point9"&lt;&lt;std::endl;
  </code></pre>
  
  <p>And this is the out of the program</p>
  
  <pre><code>point1
  point2
  point3
  point4
  point5
  point6
  defenses.size()-1=165
  cols = 12769
  Segmentation fault (core dumped)
  </code></pre>
  
  <p>A core dumped when I create a array..I don't know what's the problem.</p>