How to fix 0xC0000005 error when trying to call same function twice with reference to an array?

-3

i have a simple function like that

    function1 (string str1, string str2, int (&pos)[1])
    {
        //do some stuff
    }

and then i call it

    int main()
    {
        int test[1];
        string a, b;
        function1(a, b, test);
    }

and it works just fine if i run it only once. But if i call this function again, for instance

    int main(int test[1], string a, string b)
    {
        int test[1];
        string a, b;
        function1(a, b, test);
        function1(a, b, test);
    }

it gives me 0xC0000005 error. I can fix it by making 2 variables instead of an array with 2 elements but i want to know how to make it work with arrays.

c++
codeblocks
asked on Stack Overflow Mar 28, 2019 by Jetsu • edited Mar 28, 2019 by Jetsu

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0