I receive the error message No known conversion for argument 2 from long unsigned int to long unsigned int& when I try to compile the following code:
void build(int* &array, unsigned long& index) {
  if (index == 0)
    return;
  else {
    heapify(array, index);
    build(array, index-1);
  }
}
Can someone explain why this happens, and what the logic is behind this error?
The second argument of build requires a reference (marked with &). A reference is kind of like a pointer, so you can only use an actual variable that has a memory address.
This is why you can't use an expression like index-1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With