Question: 7. Write a C function called diff() with the prototype below that takes as input two null terminated char arrays (i.e. strings) A and B

7. Write a C function called diff() with the prototype below that takes as input two null terminated char arrays (i.e. strings) A and B and returns the difference string consisting of all chars in A that are not in B. The returned chars should be stored in a null terminated char array in the same order they appeared in A, possibly with repetitions. The returned array should be allocated from heap memory to be the same length as A (although the null terminator might not appear at the end of this array.) You may use the strlen() function found in the library string.h to determine this length. You may also assume the existence of a C function called search() as described in problem 6. char* diff(char* A, char* B){ // your code goes here

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!