Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C code called main.c to test rem.c (rem.c is posted below). Link them to

ID: 3601715 • Letter: W

Question

Write a C code called main.c to test rem.c (rem.c is posted below). Link them together and show output. Please show all work.


#include<stdio.h>
#include<string.h>

int rem(char*, char*)

{
    char input[120];
    char output[120];
    scanf("%s", input); //stores input
rem(input, output); //call to rem

printf("output: %s ", output); //prints output

return 0;
}

int rem(char*input, char*out)
{
   int a = strlen(input);//defines and stores strlen.
   int index = 0;//variable for for statement

for (int i=0; i<a; i++)
{
        if (input[i] != 'x')//input cannot equal 'x'
{ out[index] = input[i];//output and input must equal each other.
        index++;
}
}
return 0;
}

Explanation / Answer

main.c

=======


#include "rem.h"
int main (){
   rem();
return 0;
}

=============

rem.h

---

#include<stdio.h>
#include<string.h>
int rem(char*input, char*out);
int rem();

===

rem.c

===

#include "rem.h"

#include<stdio.h>
#include<string.h>
#include "rem.h"
int rem() {
   char input[120];
   char output[120];
   scanf("%s", input); //stores input
   rem(input, output); //call to rem
   printf("output: %s ", output); //prints output
   return 0;
}

int rem(char*input, char*out) {
   int a = strlen(input); //defines and stores strlen.
   int index = 0; //variable for for statement

   for (int i = 0; i < a; i++) {
       if (input[i] != 'x') //input cannot equal 'x'
               {
           out[index] = input[i]; //output and input must equal each other.
           index++;
       }
   }
   return 0;
}


===

input&output:-

======

srghyjxbnhhwxffhhx
output: srghyjbnhhwffhh

===

Thanks

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote