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
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started