1
I’m having an error when associating an array address on a pointer to struct, I’m getting a type error:
assignment to Expression with array type
The code I’m using is this:
struct MaxHeap
{
int size;
int* array;
};
struct MaxHeap* createAndBuildHeap(char array[][25], int size)
int i;
struct MaxHeap* maxHeap =
(struct MaxHeap*) malloc(sizeof(struct MaxHeap));
maxHeap->size = size; // initialize size of heap
maxHeap->array = array; // Assign address of first element of array
// Start from bottommost and rightmost internal mode and heapify all
// internal modes in bottom up way
for (i = (maxHeap->size - 2) / 2; i >= 0; --i)
maxHeapify(maxHeap, i);
return maxHeap;
Put the code as text and format it with the button
{}
. Take advantage and also include the structure definitionmaxHeap
and the call tocreateAndBuildHeap
– Isac