2 Replies - 5115 Views - Last Post: 07 March 2008 - 06:46 AM Rate Topic: -----

#1 akritiv  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 06-March 08

new operator in cpp uses heap or stack

Posted 06 March 2008 - 10:29 AM

can any one tell me :
in c++ new operator uses heap or stack or both???
Is This A Good Question/Topic? 0
  • +

Replies To: new operator in cpp uses heap or stack

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4333
  • View blog
  • Posts: 12,128
  • Joined: 18-April 07

Re: new operator in cpp uses heap or stack

Posted 06 March 2008 - 11:19 AM

When you use the new keyword you are putting it on the heap. The heap is a large chunk of memory where objects (which can be big in size) reside. The stack is for simple data types like simple integers, chars etc. :)
Was This Post Helpful? 0
  • +
  • -

#3 akritiv  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 06-March 08

Re: new operator in cpp uses heap or stack

Posted 07 March 2008 - 06:46 AM

Thanks Martyr2 for solving my query..... i thot that heap n stack both can be used when we use new operator
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1