[prev] 26 [next]

Passing structs to Functions (cont)

Can also pass a pointer to a struct

# Student stu;
# // set values in stu struct
# changeProgram(&stu, int newProgram);

   .data
stu: .space 56
program: .space 4
   .text
   ...
   la   $a0, stu
   lw   $a1, program
   jal  changeProgram
   ...

Clearly a more efficient way to pass a large struct

Also, required if the function needs to update the original struct