Data Structures: Memory

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/13

flashcard set

Earn XP

Description and Tags

Flashcards reviewing memory, pointers, and records in C.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

14 Terms

1
New cards

Byte Addressable Memory

Computer memory is usually byte addressable, meaning it can be thought of as an array of bytes, each with a unique address.

2
New cards

Word Size

In this course, a word is assumed to be 32 bits (4 bytes) long.

3
New cards

Variable Aspects

A variable has a symbolic name, a value it contains, and an address where it resides in memory.

4
New cards

LHS vs RHS in Assignment Statements

On the RHS of an assignment, we fetch the value stored at the address of the variable; on the LHS, we use the address of the variable as the place to store the result.

5
New cards

Pointers

They solve the problem of multiple functions working on the same object by allowing programmers to pass memory addresses as values.

6
New cards

Address-of Operator (&)

The & unary operator returns the address of its operand.

7
New cards

Dereference Operator (*)

On the RHS of a statement, the * unary operator returns the value stored at the address contained within its operand.

8
New cards

Arrays vs Records

Arrays model collections of values of the same type, while records model entities with values of different types.

9
New cards

Record

A compound item, unlike an array (which is homogeneous), it is heterogeneous. Components are called fields. Each field is identified using a name (not an index) and holds different properties of a single entity

10
New cards

struct

Used to define a new record type in C.

11
New cards

malloc function

Used to allocate memory dynamically from the heap.

12
New cards

sizeof function

Tells us how many bytes a record occupies.

13
New cards

Arrow (->) Operator

Selects an attribute or field of the record when using a pointer to the struct.

14
New cards

Dot (.) Operator

Accesses the fields of a struct directly (not via a pointer).