C++ Vistual Studio 0xC0000005 Error 2d vector

0

I'm trying to make a 2d array in c++ which displays next digits of pi decimals. but a line:

table[row][element] = (int)pi[counter] - 48;

I get this error: 0xC0000005 telling me that I violated access rules while reading in a location: 0x0000000000000000

How can I solve this error? I'm beginner at C++

vector<vector<int> > table;
long int couner = 0;


const string pi = "3141592653589793238462643";
    for (int row = 0; row < n; row++) {
        for (int element = 0; element < n; element++) {
            table[row][element] = (int)pi[counter] - 48;
            counter += 1;
        }
    }
c++
visual-studio
vector
asked on Stack Overflow Mar 10, 2019 by skyman503 • edited Mar 10, 2019 by Christophe

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0