Question: Write a MIPS Assembly code where you are given a null-terminated string ($a0) and you need to calculate its length and store it in ($v0).
Write a MIPS Assembly code where you are given a null-terminated string ($a0) and you need to calculate its length and store it in ($v0). Basically you should count number of characters before reaching the character with value of 0. int strlen (str) {
int len = 0;
while (str[len] != 0) // 0 != '0'
len++; return len; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
