Problem allocating memory in the "good" way

This is what i have:

Code:

`class coordinate; // (which i define later on, of course)`

coordinate*** matrix;

//Now i try to make a x*y matrix, with values which are all coordinates.

matrix = (coordinate ***) malloc (sizeof (coordinate **));

matrix[0] = (coordinate **) malloc (sizeof (coordinate*));

matrix[0][0] = NULL;

Now this works as far as i know, at least it compiles. But last time i posted here something, someone said to me that i shouldn't cast mallocs and i was given this link: FAQ > Casting malloc - Cprogramming.com

So now i try to malloc the memory the way as it should:

Code:

`matrix = malloc (sizeof ***coordinate);`

matrix[0] = malloc (sizeof **coordinate);

matrix[0][0] = NULL;

But this doesn't work, it doesn't comple. THe error i get is: type name not allowed...