Possible Duplicate:
How do I work with dynamic multi-dimensional arrays in C?
Static Matrix Casting to a pointer
my this code is throwing exception at line
           resMat[i][j] = matp[i][j];
// code begins here
    #include <iostream>
    #define MOD 1000000007
    #define LL long long
    using namespace std;
    int mat[6][64][64],mat2[2][2], mat4[4][4], mat8[8][8], mat16[16][16], mat32[32][32], mat64[64][64];
    int **point[6];
    int resMat[64][64];
    void fooMatrix(int **matp, int size)
    {
        int i,j;
        // find canFollow of all matrixes   
        for(i=0;i<size;++i)
        {
            for(j=0;j<size;++j)
            {
      // throwing exception here
                resMat[i][j] = matp[i][j];
            }
        }
    }
    int main()
    {
        point[0] = (int **)mat2;
        point[1] = (int **)mat4;
        point[2] = (int **)mat8;
        point[3] = (int **)mat16;
        point[4] = (int **)mat32;
        point[5] = (int **)mat64;
        LL a,b,res;
        scanf("%lld %lld",&a,&b);
        fooMatrix(point[a-1],1<<a);
                    return 0;
    }
i want to process on different sized matrices of int in my function fooMatrix like say store it in resMat. Help me resolve this issue.
I am using DevC++ (g++ compiler) in windows.
 
     
    