Hi, i am currently trying to program a consensus tree program, however i keep encountering the exception Unhandled exception at 0x0021ada8 in TreeBuild.exe: 0xC0000005: Access violation reading location 0x00000014.
I would like to ask for help with it
Here is my code, please help me look through it
// TreeBuild.cpp : Defines the entry point for the console application.
//
inFile >> n; //first line of file tells that there are n trees
//read in 2 trees and build consensus
getline(inFile, s1);
getline(inFile, s1);
istringstream is1(s1);
int i = 0;
while (is1 >> array1[i])
{
cout << array1[i]; //check
if (array1[i] == ';')
i=0;
root = insert(root, array1[i]); //node for each character
i++;
}
//root tree at n
rooted(root, n);
cout << "BAAAA" << endl;
cout << root->species << " ";
cout << " BAAA" << endl;
rooted(root, n);
[code]"Please use code tags"[/code]
You are probably dereferencing an invalid pointer.
I don't understand the logic of your program. How is the insertion performed?
Try to encapsulate the operations in the class.
What is the purpose of that function?
_The returned value is not being captured in main.
_The returned value could be garbage.
_Some paths don't return anything.