This is what i have:
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.comCode: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;
So now i try to malloc the memory the way as it should:
But this doesn't work, it doesn't comple. THe error i get is: type name not allowed...Code:matrix = malloc (sizeof ***coordinate); matrix[0] = malloc (sizeof **coordinate); matrix[0][0] = NULL;