title: Trying to do book cipher. Memory error(access violation)
body: <p>I'm trying to do a book cipher. I generate a vector of random numbers, then put it to the table and then I have my encrypting algorithm. It doesn't work, when I put in the algorithm the cout - it shows me properly crypted numbers. When i try to move it to my int pointer which is in main function it shows me memory error.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstdlib&gt;
  #include &lt;string&gt;
  #include &lt;algorithm&gt;
  #include &lt;vector&gt;
  #include &lt;ctime&gt;
  
  using namespace std;
  
  void generate( int tab[26][26] )
  {
          int h;
          vector&lt;int&gt; table;
          for(int i = 0; i&lt;676; i++)
          {
                  table.push_back(i+1);
          }
          int g = 0;
          random_shuffle(table.begin(), table.end());
          for(int x = 0; x &lt; 26; x++)
          {
                  for(int y = 0; y &lt; 26; y++)
                  {
                          tab[x][y] = table[g];
                          g++;
                  }
          }
  }
  
  void print_cipher_table(int tab[26][26])
  {
          char sign = 'A';
          cout &lt;&lt; "    ";
          for (int n = 0; n&lt;26; n++)
          {
                  cout &lt;&lt;  sign++ &lt;&lt; "   ";
          }
          cout &lt;&lt; "\n";
          sign = 'A';
          for(int x = 0; x&lt;26; x++)
          {
                  cout &lt;&lt; sign++ &lt;&lt; "  ";
                  for(int y = 0; y&lt;26; y++)
                  {
                          if(tab[x][y] &lt; 10) cout &lt;&lt; "00" &lt;&lt; tab[x][y] &lt;&lt; " ";
                          else if(tab[x][y] &lt; 100) cout &lt;&lt; "0" &lt;&lt; tab[x][y] &lt;&lt; " ";
                          else cout &lt;&lt; tab[x][y] &lt;&lt; " ";
                  }
                  cout &lt;&lt; "\n";
  
          }
  }
  
  void encrypting(int tab[26][26], string s_true, string s_false, int *result)
  {
          int row, column, i=0;
  
          while(s_true[i])                // pêtla wykonuje siê dopóki nie napotka na koniec stringu
          {
                  if(s_true[i]&gt;64 &amp;&amp; s_true[i]&lt;91)
                  {
                          row = s_true[i] -'A';
                          column = s_false[i] - 'A';
                  }
                  else {
                          cout &lt;&lt; "NIE PODAŁEŚ WIELKICH LITER!" &lt;&lt; endl;
                          exit(0);
                  }
  
                  cout &lt;&lt; "\t" &lt;&lt; tab[row][column];
                  result[i] = tab[row][column];
                  i++;
          }
  }
  
  int main()
  {
          int tab[26][26], slength, *crypted;
          string s_true, s_false;
          string letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
          cout &lt;&lt; "Prosze podac tekst prawdziwy: ";
          cin &gt;&gt; s_true;
          cout &lt;&lt; "Prosze podac tekst falszywy: ";
          cin &gt;&gt; s_false;
          if(s_true.length() != s_false.length())
          {
                  cout &lt;&lt; "Chujowa dlugosc tekstu. Wypierdalaj";
                  exit(1);
          }
          slength = s_true.length();
          generate( tab );
          print_cipher_table( tab );
          cout &lt;&lt; "\n\n\n";
          encrypting(tab, s_true, s_false, crypted);
          cout &lt;&lt; *crypted;
          return 0;
  }
  </code></pre>