Question: 2 . 3 Task 2 : Print Words This task scans through a string, converts spaces ( just spaces, not other whites - pace )

2.3 Task 2: Print Words
This task scans through a string, converts spaces (just spaces, not other whites-
pace) into null terminators, counting how many times it does this as it goes.
When it hits the end of the string, it then moves backwards, and prints out
each word; since the spaces have been turned to null terminators, each will be
just a simple word, not the whole line.
Implement the following C code:
if (printWords !=0)
{
char *start = theString;
char *cur = start;
int count =1;
while (*cur !='\0')// null terminator. ASCII value is 0x00
{
if (*cur ==,')
{
*cur ='\0';
count++;
}
cur++;
}
printf("printWords: There were %d words.
", count);
while (cur >= start)
{
if (cur == start || cur[-1]=='\0')
printf("%s
", cur);
cur--;
}
}
i would like the code in assembly mips . print the string strating from last word to the first : example if we have " i need help" the out put is "help need i"
2 . 3 Task 2 : Print Words This task scans

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 Programming Questions!