❶ 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中隨意加 ,不是表示要求用戶輸入回車符,而是忽略一切空白符,直至下一個非空白符輸入