Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
Dynamic Memory Allocation in c++

Dynamic Memory Allocation in c++

Ratings: (0)|Views: 25 |Likes:
Published by Tech_MX

More info:

Published by: Tech_MX on Sep 03, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PPTX, PDF, TXT or read online from Scribd
See more
See less

09/03/2012

pdf

text

original

 
PROBLEMS WITH NORMAL ARRAYVARIABLE DECLARATION
Int main() // 1 . Size fixed{Int A[5];Int B[n]; // 2. Error..Size must be known atcompile time.}Will not work for larger programs because of the limited size of thestack.
1020 1022 1024 1026 1028A[0] A[1] A[2] A[3] A[4]
 
HEAP AND STACK
Our program when loaded in to main memory is divided in to 4segments :CODE,DATA,STACK,HEAP
 Adata segmentcontains the global variables and static variables.
Acode(text) segmentcontains the executable instructions.
 AStack segmentstore all theauto variables. Also each function call involves passing arguments from the caller to the callee. The calleemay also declare variables. Function parameters ,return addressand
automatic 
local variablesare accommodated in the stack.
Hence a
stack 
is an area of memory for storing data temporarily.

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->