Question: C Programming: #include #include strlib.h void check_compare (char* a, char* b) { if (!my_strcmp (a, b)) { printf (Strings match! ); } else { printf

C Programming:

C Programming: #include #include "strlib.h" void check_compare (char* a, char* b) {

#include #include "strlib.h"

void check_compare (char* a, char* b) { if (!my_strcmp (a, b)) { printf ("Strings match! "); } else { printf ("Strings DONT match! "); } }

int main (int argc, char** argv) { char foo[] = "Foo"; char empty[] = ""; char str1[] = "ECE Programmers are the best!"; char str2[] = "ECE Programmers are the best!";

printf (" length of foo: %i ", my_strlen(foo)); printf ("length of empty: %i ", my_strlen(empty)); printf (" length of str1: %i ", my_strlen(str1)); printf (" length of str2: %i ", my_strlen(str2));

printf ("----------------------- "); printf ("Comparing foo to empty: "); check_compare (foo, empty); printf ("Comparing str1 to str2: "); check_compare (str1, str2);

return 0; }

Need 3 files:

strlib.h

strlib.c

test.c

(15 Points You are going to write your own miniature set of string utilities. The implementations of these functions should go into their own file named strlib.c. The prototypes for functions defined in strlib.c should be declared in strlib.h. You will write both of these files. our str ib should implement two functions int my-strlen char string) Counts the number of characters in the string at memory address string. The count should not include the null character "Vo int my-strcmp(char a, char b) Compares strings pointed to by a and b. If the two strings match, return 0 otherwise, return 1. You should not need to include any headers in strlib.c. ese operations can be implemented in "straight C." Test your code using the following test harness

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!