Question: please solve and explain all steps Task 1: Rightmost occurrence In this program(https://www.onlinegdb.com/tas/32618), a sample function strindex is given which has two parameters - char

please solve and explain all steps  please solve and explain all steps Task 1: Rightmost occurrence In
this program(https://www.onlinegdb.com/tas/32618), a sample function "strindex" is given which has two parameters
- char s[] and char t(). It returns the left most position

Task 1: Rightmost occurrence In this program(https://www.onlinegdb.com/tas/32618), a sample function "strindex" is given which has two parameters - char s[] and char t(). It returns the left most position of tin s. You are going to complete the function "strindexr" which has two same parameters but returns the right most position of t in s. Return-1 if there is none. The main function is used to test your function. It will print out both the left and right most index of occurrence of pattern in line. 1 #include 2 #define MAXLINE 1000 3 4 int strindex (char source(), char searchfor[]); 5 int strindexr (char source(, char searchfor(); 6 7 char pattern ] "ould"; /* pattern to search */ 8 9 int 10 main () 11- { 12 extern char posterno; 13 char line[MAXLINE) - "I would would like to test this if i could"; 14 printf ("strindex: %d\tstrindexr: %d ", strindex (line, pattern), strindexr (line, pattern)); 17 18 return 0; 19 } 20 21 int 22 strindex (char s[], char to)) 23- { 24 int i, j, k; 15 16 t[k]; j++, K++) 32 23- { 24 int i, j, k; 25 26 for (i = 0; s[i] != '\0'; i++) 27 { 28 for (j = i, k = 0; t[k] != '\0' && s[j] 29 30 if (k > 0 && t[k] '\0') 31 return i; } 33 return -1; 34 } 35 36 int 37 strindexr (char source(), char searchfor() 38 - { // YOUR CODE HERE 40 return -1; 41 } 42 43 44 39

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!