Question: Name (10 pts) The function countChars charstr chartarget) returns the number of times characters in target appear in str. For example: int countChars(char str, char

 Name (10 pts) The function countChars charstr chartarget) returns the number

Name (10 pts) The function countChars charstr chartarget) returns the number of times characters in target appear in str. For example: int countChars(char str, char target) countChars( abc abc abc", "a") 3 countChars("abc abc abc", "ab") 6 countChars("abe abc abc", "abcd")-9 Int count 0; while ("str) ( count +a isCharinStr(target, "str) str++ The C code for countChars is given to you in the box on right. The helper function isCharinStr(char *target, char c) returns 1 if c is present in target and O if not. return count; Finish the implement of countChars in MIPS below. countchars addiu $sp, sp, store onto the stack if needed addiu $so, $ zero, o # we'll store the count in Ss0 addiu $si, $ao, o addiu $82, $al, o loop: addiu $ao, $s2, 0 beq jal isCharInstr done: # Load from the stack if needed addiu $sp, $sp dr $ra

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!