Search for question
Question

Task 6.1: Comparing strings

In this exercise, you will consider comparing strings.

1. The following C code implements the strcmp function (http://linux which.

net/man/3/strcmp). Explain how the function works!

1 int stremp(char *a, char *b) {

2 while (*a

*b) (

3

if ("a

4

5

6

8

return 0;

return a "b;

2. Translate this C code into MIPS Assembler. Comment on your assembler-

Code. When commenting, note that the relationship between C-

Code and MIPS assembler is clearly displayed. Remember, all use-

to cache these registers on the stack!

5 Points

10 Points

Fig: 1