[prev] 21 [next]

Structs in MIPS (cont)

C struct definitions effectively define a new type.

// new type called "struct _student"
struct _student {...};
// new type called Student
typedef struct _student Student;

Instances of structures can be created by allocating space:

                  # sizeof(Student) == 56
stu1:             #Student stu1;
   .space 56
stu2:             #Student stu2;
   .space 56
stu:
   .space 4       #Student *stu;