Inserting and Extracting data from **nodes

// I have to put value in character and frequencies in a following array of objects size two. But running the program is giving me error. What am i doing wrong?

#include <fstream>
#include <iostream>
#include <sstream>
#include "huffman.h"
using namespace std;
struct HuffNode
{
char character;
int frequency;
};

int main()
{
HuffNode **arr;
arr[0]->character = 'a';
arr[0]->frequency = 1;
arr[1]->character = 'b';
arr[1]->frequency = 4;
for (int i = 0; i < 2; i++)
{
cout << "arr[i]->character is: " << arr[i]->character << endl;
cout << "arr[i]->frequency is: " << arr[i]->frequency << endl;
}
return 0;
}
Last edited on
Topic archived. No new replies allowed.