как исправить ошибку: #include <iostream>
using namespace std;
struct dataFreq {
	char data;
	int freq;
};
struct codeTable {
	char* code;
	char data;
};
struct minHeapNode {
	dataFreq *df;
	minHeapNode* left, * right;
};
struct minHeap {
	int size;
	int capacity;
	minHeapNode** arr;
};
minHeapNode* newNode(dataFreq *df) {
	minHeapNode* temp = new minHeapNode;
	temp->left = temp->right = nullptr;
	temp->df = df;
	return temp;
}
minHeap* createMinHeap(int capacity) {
	minHeap* mh = new minHeap;
	mh->size = 0;
	mh->capacity = capacity;
	mh->arr = new minHeapNode*[capacity];
	return mh;
}
void swapMinHeapNode(minHeapNode** a, minHeapNode** b) {
	minHeapNode* t = *a;
	*a = *b;
	*b = t;
}
void minHeapify(minHeap* mh, int idx) {
	int smallest = idx;
	int left = 2 * idx + 1;
	int right = 2 * idx + 2;
	if (left < mh->size && mh->arr[left]->df->freq < mh->arr[smallest]->df->freq) {
		smallest = left;
	}
	if (right < mh->size && mh->arr[right]->df->freq < mh->arr[smallest]->df->freq) {
		smallest = right;
	}
	if (smallest != idx) {
		swapMinHeapNode(&mh->arr[smallest], &mh->arr[idx]);
		minHeapify(mh, smallest);
	}
}
minHeapNode* extractMin(minHeap* mh) {
	minHeapNode* temp = mh->arr[0];
	mh->arr[0] = mh->arr[mh->size - 1];
	--mh->size;
	minHeapify(mh, 0);
	return temp;
}
void insertMinHeap(minHeap* mh, minHeapNode* mhNode) {
	++mh->size;
	int i = mh->size - 1;
	while (i && mhNode->df->freq < mh->arr[(i - 1) / 2]->df->freq) {
		mh->arr[i] = mh->arr[(i - 1) / 2];
		i = (i - 1) / 2;
	}
	mh->arr[i] = mhNode;
}
void buildMinHeap(minHeap* mh) {
	int n = mh->size - 1;
	for (int i = (n - 1) / 2; i >= 0; i--) {
		minHeapify(mh, i);
	}
}
minHeap* createAndBuildMinHeap(dataFreq *df, int size) {
	minHeap* mh = createMinHeap(size);
	for (int i = 0; i < size; i++) {
		mh->arr[i] = newNode(&df[i]);
	}
	mh->size = size;
	buildMinHeap(mh);
	return mh;
}
minHeapNode* buildHuffmanTree(dataFreq *df,int size) {
	minHeapNode *left, *right, *top;
	minHeap* mh = createAndBuildMinHeap(df, size);
	while (mh->size>1) {
		left = extractMin(mh);
		right = extractMin(mh);
		dataFreq* ndf = new dataFreq;
		ndf->data = '$'; // $ специальное значение для внутренних нод
		ndf->freq = left->df->freq + right->df->freq;
		top = newNode(ndf);
		top->left = left;
		top->right = right;
		insertMinHeap(mh, top);
	}
	return extractMin(mh);
}
void printCodes(minHeapNode* root, int* arr, int top, codeTable ct[]) {
	if (root->left) {
		arr[top] = 0;
		printCodes(root->left, arr, top + 1,ct);
	}
	if (root->right) {
		arr[top] = 1;
		printCodes(root->right, arr, top + 1,ct);
	}
	if (!(root->left) && !(root->right)) { // если это нода листья тогда она содержит вводимый символ
		ct->data = root->df->data;
		cout << root->df->data << ": ";
		for (int i = 0; i < top; i++) {
			ct->code[i] = arr[i];
			cout << arr[i];
		}
		cout << "\n";
	}
}
void huffmanCodes(minHeapNode* root, codeTable ct[]) {
	int arr[256], top = 0;
	printCodes(root, arr, top,ct);
}
void decodeDataHuffman(minHeapNode* root,const char* str) {
	const char* ans = "";
	minHeapNode* current = root;
	for (int i = 0; i < strlen(str); i++) {
		if (str[i] == '0') {
			current = current->left;
		}
		else {
			current = current->right;
		}
		if (current->left == nullptr && current->right == nullptr) {
			ans += current->df->data;
			current = root;
		}
	}
	cout << ans << "\n";
}
int main() {
	const char* str = "beep boop beer!";
	dataFreq freqTable[256]; // в ASCII 256 символов
	int count = 0;
	for (int i = 0; str[i] != '\0'; i++) {
		bool found = false;
		for (int j = 0; j < count; j++) {
			if (str[i] == freqTable[j].data) {
				freqTable[j].freq++;
				found = true;
				break;
			}
		}
		if (!found) {
			freqTable[count].data = str[i];
			freqTable[count].freq = 1;
			count++;
		}
	}
	for (int i = 0; i < count; i++) {
		cout << freqTable[i].data << ' ' << freqTable[i].freq << '\n';
	}
	minHeapNode* root = buildHuffmanTree(freqTable, count);
	codeTable ct[256];
    huffmanCodes(root,ct);
	//encodeDataHuffman(root,str);
	//decodeDataHuffman(root,)
	return 0;
}