Sparashy
Sparashy

Reputation: 1

Huffman Coding Error When Passing Parameter

code:

typedef struct
{
    int weight;
    char c;
    int parent, lchild, rchild;
} Node, *HTree;

void findmin(HTree ht, int len, int *p1, int *p2)

void CreateHTree(HTree ht, int n)

void print(HTree ht,int n)
{
    for(int i=1;i<=2*n-1;i++)
    {
        printf("%d %d %d\n",ht[i].parent,ht[i].lchild,ht[i].rchild);
    }
}

int main()
{
    int n;
    scanf("%d", &n);
    HTree ht;
    char **hc;
    CreateHTree(ht, n);
    print(ht,n);
    return 0;
}

Well, when I transfer parameter ht, it seems never transfer correctly. Can someone tell me how to solve it? :(

I just want to know what's wrong.

Upvotes: 0

Views: 11

Answers (0)

Related Questions