Pointer to a MIPS pointer to a pointer?

I think I know how to handle this, but I just want to make sure that everything is correct. Say you have the following C code:

int myInt = 3; int* myPointer = &myInt; int** mySecondPointer = &myPointer; 

P contains an address indicating a place in memory that has a different address. I would like to change the second address. So the MIPS code:

 la $t0, my_new_address lw $t1, ($a0) # address that points to the address we want to modify sw $t0, ($t1) # load address into memory pointed to by $t1 

Is that how you did it?

+4
source share
1 answer

Yes, that’s right, as far as I can tell. It would be easier if you used the same variable names (e.g. characters instead of hard case names).

Why didn’t you just compile the c-code and look at the file list or assembly-output? I always do this when in doubt.

+4
source

Source: https://habr.com/ru/post/1276903/


All Articles