-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 に答える