Initialize
#include <stdio.h>
#define MAX 100
 
typedef struct Bheap {
    int array[100];
    int cnt;
} Bheap;
 
void initialize(Bheap *H)
{
    H->cnt = 0;   // becareful! start to store data at H->array[1];
}
 
int num_of_item(Bheap *H)
{
    printf("The heap has %d item\n", H->cnt);
    return H->cnt;
}
 
void print(Bheap *H)
{
    int i;
    for (i = 1; i <= H->cnt; i++)
        printf("%d ", H->array[i]);
 
    printf("\n");
}
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License