pointers_elaboration

pointers_elaboration - CDA 3101 - Lecture #15+ - 200806.16...

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

View Full Document Right Arrow Icon
CDA 3101 -- Lecture #15+ -- 200806.16 Elaboration on the pointers handout What to do with a variable when translating C code to MIPS First thing to recognize is that, in general, a variable (whose value may be constant) will either be implemented using a register or main memory to represent the value. We can always use main memory (though accessing the variable's value will be slower); but there are many times when we have the option of using a register. Pointers and arrays An array is a chunk of contiguous memory where a collection of like typed items can be stored. A pointer is a memory address that is associated with a type (e.g., int, char, structure, etc.). The size (in bytes) of the type is used to compute offsets when using array notation/pointer arithmetic. A pointer may be pointing to a single instance of that type, or it may be pointing to one of many instances of that type that are stored in an array: there is nothing in C or MIPS syntax that differentiates between a pointer to a single item vs. a pointer to one of many items. A pointer, whether to a single item or to the ±rst element of an array, might be implemented using either: * a dedicated register (holding the address of the item/array's ±rst element) or * a memory location (holding the address of the item/array's ±rst element). C speciFcs
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/15/2012 for the course CDA 3101 taught by Professor Small during the Summer '08 term at University of Florida.

Page1 / 4

pointers_elaboration - CDA 3101 - Lecture #15+ - 200806.16...

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

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