Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Array 3D problem

$
0
0

Hello guys. I have declared a 3D Global integer array:

namespace Math
{
    public static class GV
    {
        public static int[][,] a;

        public static void InstantiationArray(int[,] a, int n, int m)
        {
            for (int i = 0; i < n; ++i)
                for (int j = 0; j < m; ++j)
                    a[i, j] = new int();
        }
    }
}

And in my form, when a button is pressed, the next code is executed:

GV.a[0] = new int[n, m];
GV.InstantiationArray(GV.a[0], n, m);

and when I run the program I get this Exception: Object reference not set to an instance of an object.


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>