-6

谁能帮我将下面的 C 代码转换为 MIPS 代码?我应该使用递归并得到 21 - 2 作为最终答案。谢谢!

/*
x is a pointer to a linked list node and is not null.
Return the min value stored in the linked list.

Assume each node is stored in memory as an int (value) followed by a pointer to the next node (next), each a word wide.
You must write it with recursion.  */

int findMin(node *x) {
    if(x->next == NULL)
        return x->value;
    else {
        int min = findMin(x->next);
        if(min < x->value) 
            return min;
        else
            return x->value;
    }
}
4

1 回答 1

3

给你:

mips-linux-gnu-gcc -S -o foo.asm foo.c
于 2013-03-11T05:29:53.807 回答