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.
findminandCreateHTree, so this can't even compile. If you're going to provide example code in a question, always provide complete code (which this isn't) that compiles. Otherwise, no one can help you. See stackoverflow.com/help/minimal-reproducible-examplehtis an uninitialized pointer, andCreateHTree()returns nothing. So there is no way to get anything back fromCreateHTree(). What the heck ishc? It is not used.