Mips programming question. Please include comments. Write a program that asks th
ID: 3865585 • Letter: M
Question
Mips programming question. Please include comments.
Write a program that asks the user to input a string (or no more than 50 characters). Your program should then output the length of the string. The string length should be determined using a separate function strlen that will accept the address of the string and return its length. For the purposes of this exercise, the length of a string will be defined as the number of non-null and non-newline characters until either the null character (ASCII 0) or the newline character (ASCII 10) is encountered.
Explanation / Answer
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int Strlen(char* str)
{
int count=0;
int i;
for(i=0;str[i]!='';i++)
{
count++;
}
return count;
}
void main(){
char str[25];
printf("Enter the string");
scanf("%s",str);
printf("%s",str);
int count=Strlen(str);
printf("the length of the string is %d",count);
}