Here is my code so far. ELEMENT is a class object that so far isn't giving me any trouble:
struct HEAP {
public:
int size;
static int capacity;
ELEMENT H[capacity];
HEAP Initialize(int capacity);
}
HEAP HEAP::Initialize(int capacity) {
ELEMENT * myHeap;
myHeap = new ELEMENT [capacity];
}
int n;
n = 3;
Initialize(n);
I am new to C++ so I think I am unclear with how I am supposed to use class functions. Basically what I am trying to do is to initialize an array of pointers to element objects, and call that a heap. How am I using C++ functions incorrectly here? I'm used to Java so this feels a bit foreign to me.