Problem with Making a Matrix

closed account (zb0S216C)
Firstly, here's my code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
int *Matrix( NULL );

void MakeMatrix( const int FaceCount = 0, const int ElementCount = 0 )
{
    if( ( FaceCount > 0 ) && ( ElementCount > 0 ) )
    {
        Matrix = new int[ FaceCount ][ ElementCount ];
        
        for( unsigned Index( 0 ); Index < FaceCount; Index++ )
        {
            for( unsigned SubIndex( 0 ); SubIndex < ElementCount; SubIndex++ )
            {
                Matrix[ Index ][ SubIndex ] = 0;
            }
        }
    }
}


The compiler is giving me this error: 'ElementCount' cannot appear in a constant-expression

Is there a way to fix this?
Do you have ElementCount declared somewhere else?
Topic archived. No new replies allowed.