![]() On Fri, at 3:51 PM, ajay.kakumanu via cpp-l wrote: Return 10,// Return values are stored in Stack Segment. Static int x // Un Initialized Static variables, stored inįun(int x,int y) // function parameters x and y variables are stored Static int p=10 // Initialized Static variables, stored in Ptr=malloc/calloc( 100 bytes) // dynamic memory allocation( allocated from HeapĬhar *str=" I am a good buy " // This String is stored in Read Only Int y=10 // Auto Variable ( Stored in Stack Segment)Ĭonst int z=25 // Stored in Stack Segment Int x // Auto Variable ( Stored in Stack Segment) Initialized Global variables, stored in Initialized Data segment. Int a // Un Initialized Global variables, stored in Un-Initialized Zeroes (using memset?), If all Un-Initialized data are stored at same It is easy to initialized all un-initialized static variables to The Reason why again divided the Data segment into 2 sections Static int x =5,then X is stored in Initialized section Static int x, then x is stored in un-Initialized section In both statements X is stored in data segment only,īut the difference is internally Data segment have 2 sections Pleas find the following description which I have given long back. etcĥ Heap Segment : All dynamic memory allocations done here. Text Segment(read only segment) : all strings, constant are stored hereģ Data Segment : Static and gobal variables are stored here.Ĥ Stack Segment : Local variables, function parameters, return values. Code Segment : All instructions are stored here.Ģ. Generally C-programme has following memory segements.ġ. Here I am giving Memory Layout of C programme. guy so better if somebody corrects me if I = Urself by using the purify or some other tool.ĭelete pObj // Catastrophe - inviting problemsĪgain, I am not a Comp. 'delete' and ' delete' doesn't make much difference. ![]() This is the reason when u r allocating for some basic data type, = Information, read Effective C++ and More Effective C++. Just 'delete p', the result is really catastrophic. Using so that for every object it's destructor is called. The objects so if u have allocated using, you should delete them = P", just don't releases the memory but it also calls the destructor of = guys who has worked on compilers may throw more light here.Īs far as ' delete' is concerned, you may be knowing that "delete = The allocated memory, though I am not an expert here. Http:/ Opens a new window / / new_mailĪs far as I know, the additional memory is continuously aligned with = Yahoo! Mail - 50x more storage than other providers! > I would like to have consideration of you people on I better run a backup and call it a night, g'night! Hrm, my hdd is spinning up and down like nuts, I think Just shutdowns the dosbox and not the entire systems Of course using that method, you'll have to use yourĬonstructor to initialize elements prior to use. Heap and to access it you use *p= some number P is a integer on the local stack that contains theĪddress of the beginning of the 11 byte array on the In a parking lot where the attendant is at the boothĪnd point finger at your saab in another location.Įxample of heap memory assignment and use is like this Of the location of varible in heap memory. The heap varibles are a 4byte ulong that is an address Register in the CPU, this is the way it is implementedīy pretty much all high level languages today. The stack and access via the BP (Base pointer) ![]() Local procedural varibles are declared and stored on
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |