I have this function:
int firstHeapArray (IntHeapArray h) {
if(!emptyHeapArray(h))
return h.array[0];
}
It’s declared as int, and this is the IntHeapArray struct:
typedef struct intHeapArray {
int *array;
int size;
} IntHeapArray;
Can you say why I get this warning while compiling?
heap-test.c: In function ‘firstHeapArray’:
heap.h:31:1: warning: control reaches end of non-void function
Thank you very much.
The error message is stating that you have a method that is not a
voidreturn, but you’re reaching the end without returning a value. You need to return a valid int value.The problem is here: