Question: Two C functions (stringlen.c and StringReverse.c) are shown in the following with the function defined as: stringlen - find the length of a string, input:
- Two C functions (stringlen.c and StringReverse.c) are shown in the following with the function defined as:
stringlen - find the length of a string, input: pointer to a string
StringReverse reverse the letters of a string, input: pointer to a string
Writebothin MIPS assembly language code.
uint8_t stringlen(const uint8_t str[])
{
uint8_t index=0;
while(str[index]!=0)
{
index++;
}
return index;
}
void StringReverse(uint8_t str[])
{
uint8_t i=0;
uint8_t j=stringlen(str)-1;
uint8_t temp;
while(i)>
temp=str[i];
str[i]=str[j];
str[j]=temp;
i++;
j--;
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
