Structures Flashcards

(5 cards)

1
Q
  • Collection of data with different types
  • Contiguous bytes of memory divided according to data type used by user
A

Structures

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

In structures, we need to know the following:

A
  • the size of each field
  • the size of the whole structure
  • the starting address of each field
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

True or False

To access a specific field, just identify the address of that field by specifying its offset from the base address.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Convert this to assembly:

struct student {
char name[10];
int age;
int score;
};
struct student x;
A

Define structure size:

student equ 13

Define starting byte of each field:

name equ 0
nameLen equ 10
age equ 11
score equ 12
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Accessing Members/Fields

A
  • specify array cell to use (i*size)
  • specify field to use
How well did you know this?
1
Not at all
2
3
4
5
Perfectly