❶ C语言代码运行问题,为什么编译通过,但是运行时直接结束,没有输入
请把最后两行从main()中移出来:
typedef struct tree
{
int weight;
int parent;
int lchild;
int rchild;
}HTNode,*HuffmanTree;
//定义编码
typedef struct code
{
int bit[MAX];
int start;
}HCNode,*HuffmanCode;
HTNode HT[MAX]; //移到这里
HCNode HC[MAX];
❷ 编译运行的c程序不能输入
scanf("%d", &t);
不要再scanf中随意加 ,不是表示要求用户输入回车符,而是忽略一切空白符,直至下一个非空白符输入