C로 최소(min) heap을 사용하는것인데 incompatible types에러가 뜨네요..
#include <stdio.h>
#include <stdlib.h>
#define max_ele 1200
typedef struct {
int key;
int num;
} ele;
typedef struct {
ele heap[max_ele];
int heap_size;
} heapcode;
ele heap[max_ele];
void int_minheap(heapcode *h, ele p)
{
int i;
i = ++(h->heap_size);
while((i != 1) && (p.key < h->heap[i/2].key)){
h->heap[i] = h->heap[i/2];
i /= 2;
}
h->heap[i] = p;
heap[i].num = 1;
}
해서 삽입함수를 구현 한 다음; 메인에서..
ele i;
int e = 0;
그다음 뭐 함수 쭈욱 쓰고..
while(fscanf(input_d,"%d",&i)!=EOF)
{
int_minheap(&i,e); // error C2115: 'function' : incompatible types << 요기가 에러납니다;;
if(fgetc(input_d) == EOF)
{
break;
}
}
아무리봐도 모르겠네요.. orz
int_minheap(&i,e); 부분에서 인자와 다른 타입을 넣으니깐 에러가 나는 것 같네요.
위에 fscanf하는 부분으로 보건데 i는 숫자인것 같은데, 그 것을 바로 int_minheap함수에 넣어서 에러가 나는 것 같습니다.