What's wrong with this code because I'm getting errors but everything looks fine though.
Cross213
-5
Posting Whiz in Training
Recommended Answers
Jump to PostAnd what are your errors?
I would rather see the code posted here instead of download your files...
Jump to PostIf I remember correctly about pointer, line 14 in your BinaryTree
void BinaryTree::insert(int& data)
Are you expecting a pointer for it (with the & symbol), or just a plain integer value? Because you are calling it as
b.insert(60);
I don't know your node structure …
Jump to PostWhen you use "&" in your function declaration, it expects you to pass by reference. As a result, the argument passed in should be variable.
int x=60; b.insert(x);
But I do not believe that the insert() function should take an integer argument that way. Because if the …
Jump to PostIt is a value, but it is a copied value. Why would you want to take an object? If you look at your nodeType struct, it takes only a value (data) which can be copied over instead of a variable pointer.
All 13 Replies
Taywin
312
Posting Virtuoso
Cross213
-5
Posting Whiz in Training
Cross213
-5
Posting Whiz in Training
Cross213
-5
Posting Whiz in Training
Taywin
312
Posting Virtuoso
Cross213
-5
Posting Whiz in Training
Cross213
-5
Posting Whiz in Training
Taywin
312
Posting Virtuoso
Cross213
-5
Posting Whiz in Training
Taywin
312
Posting Virtuoso
Cross213
-5
Posting Whiz in Training
mrnutty
761
Senior Poster
Cross213
-5
Posting Whiz in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.