Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where is the call to new and delete ? 1

Status
Not open for further replies.

areza123

Programmer
Jul 4, 2002
60
IN
in a method
void print_mesg(const char *s) {..} // do something

int main()
{
print_mesg("Hello");
}

Where is the new method to hold "Hello". Also I don't need to call delete []s exclusively ? There is no memory leak here ? Why ?
 
That data "Hello" is going to be placed into the data segment of the program and loaded on the stack when the program is copied into memory. There is no heap allocation for it.

Does that answer your question?

-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top