View Single Post
Old Nov 23rd, 2009, 11:19 AM   #5
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 7,869
Rep Power: 14 DaWei will become famous soon enoughDaWei will become famous soon enough
Re: Problem with pointer in function return

I gave you the correct term to Google. Here are the first two paragraphs from the first hit for C++ scope:

Quote:
C++ names can be used only in certain regions of a program. This area is called the "scope" of the name. Scope determines the "lifetime" of a name that does not denote an object of static extent. Scope also determines the visibility of a name, when class constructors and destructors are called, and when variables local to the scope are initialized. (For more information, see Constructors and Destructors.) There are five kinds of scope:

*

Local scope A name declared within a block is accessible only within that block and blocks enclosed by it, and only after the point of declaration. The names of formal arguments to a function in the scope of the outermost block of the function have local scope, as if they had been declared inside the block enclosing the function body. Consider the following code fragment:
This tells you that nod is only valid inside the function where it is defined.

Search is the first part. The second is the ability to read and comprehend. The are requirements for a good programmer because the time economy is important.
__________________
The person who coined the phrase, "There's no such thing as a stupid question," hasn't hung around here much.

Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
Politically Incorrect
DaWei is offline   Reply With Quote