Pointers

Pointers - • Disadvantage may lead to programming errors...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Pointers Muldner, Chap. 8
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8: Preview Java references versus C pointers address and dereferencing operations dynamic memory allocation and deallocation pointer arithmetic passing function parameters by reference passing functions as parameters of other functions
Background image of page 2
8: Stack and Heap Based Memory Run-time stack Heap push pop top stack free heap
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8: Stack and Heap Based Memory Stack-based memory : implicitly managed by function calls and function returns. Advantage: you do not have to be concerned with deallocation.
Background image of page 4
Background image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: • Disadvantage: may lead to programming errors, e.g. • dangling reference problem • a variable referencing a memory block • whose lifetime has expired 8: Stack and Heap Based Memory • Heap-based memory : explicitly managed by the programmer. • May result in heap fragmentation • C programmers are responsible for memory management • Improper memory management may lead to memory leakage...
View Full Document

This note was uploaded on 02/18/2012 for the course CS 240 taught by Professor Rego during the Fall '08 term at Purdue.

Page1 / 5

Pointers - • Disadvantage may lead to programming errors...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online