I am trying to create a class as such:
class CLASS { public: //stuff private: int x, y; char array[x][y]; };
Of course, it does
You can allocate memory to your 2-dimensional array in the constructor and free it in the destructor. The simplest way:
array = (char **)malloc(sizeof(char *) * x); if (array) { for (i = 0; i < x; i++) { array[i] = (char *)malloc(sizeof(char) * y); assert(array[i]); } }