As answered by Stroustrup:
In C++, the definition of NULL is 0, so there is only an aesthetic difference. I prefer to avoid macros, so I use 0. Another problem with NULL is that people sometimes mistakenly believe that it is different from 0 and/or not an integer. In pre-standard code, NULL was/is sometimes defined to something unsuitable and therefore had/has to be avoided. That's less common these days.
~s.o.s~
Failure as a human
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
>I am sorry for that I can't understand what's this sentence's meaning?
Where did you find that sentence? It's nowhere in this thread.
>Can you tell me what is your opinion in whether use "NULL" in C++?
0 and NULL are the same thing in C++. Pick one and use it consistently.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
> Where did you find that sentence? It's nowhere in this thread.
Yes, its my damned signature. :D
~s.o.s~
Failure as a human
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
Get a more interesting signature! If I don't notice it, it's not worth reading.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
Pushing twigs with one's nose never was interesting... :-)
Plus, the more interesting my signatures become, the more debate it sparks and more are the threads created in the Moderators Place. ;-)
~s.o.s~
Failure as a human
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
The Moderator's Place has been too slow anyway. If you want, I can suggest one:
I hate VB.NET’s continuous bloody interference. I HADN’T FINISHED TYPING YET YOU STUPID COMPILER! CAN’T YOU SEE THAT? DOES IT LOOK TO YOU LIKE I’M DONE TYPING? DID IT NOT OCCUR TO YOU THAT THE REASON YOU’VE FOUND ALL THOSE ERRORS IS BECAUSE I’M NOT FINISHED YET?!! I’LL TELL YOU WHEN I WANT YOU TO CHECK MY WORK, AND NOT BEFORE!
-- Ian Griffiths
Ah, that guy can totally read my mind. ;)
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
Heh good one. But since it seems that I seem to be the center of most discussions there, maybe its time someone else started playing the part of a scape goat. ;-)
~s.o.s~
Failure as a human
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
I can't imagine why you're so popular. I'm several orders of magnitude worse than you and nobody bats an eyelash. :icon_rolleyes: Maybe you're too nice. Try being meaner and you'll be accepted.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
> I can't imagine why you're so popular.
Friendly would be more like it.
> I'm several orders of magnitude worse than you and nobody bats an eyelash.
Maybe they have got used to you.
> Maybe you're too nice. Try being meaner and you'll be accepted.
Maybe an official training from you would do the job. ;-)
~s.o.s~
Failure as a human
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
>What's the differences between struct and class(all member is public)?
Default access to a class is private and default access to a struct is public.
>And he say that the "BinaryNode sturct is too 'C'
It sounds like he doesn't know what he's talking about. Rather than follow bad advice, first learn how trees work and then look at the different ways you can implement them.
>2.How to make this program runs?
My recommendation is to stop using classes. Trying to contain a tree structure into a class just complicates everything by adding an extra layer of fat. It's easier to learn how to use trees with just a structure and a few functions and then add a class framework later.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
You're making everything harder by trying to do too much, too soon. I don't care if you try, but I'm not going to help you run yourself into a wall.
>Ah,do you know that C and C++ is looked as the water and fire in China!
>If someone use C style code in *.cpp,he will be considered as a laypeople.
Not just China. Clueless people all over the world seem to think that C-style code in C++ is somehow less "pure". They're wrong, of course, and you shouldn't listen to them.
>Could you tell me why the code can't pass the compiler?
Do a Google search for PEBKAC and you'll discover the problem.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401