Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

#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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Build It For The Real World A Database Workbook

Authors: Wilson, Susan, Hoferek, Mary J.

1st Edition

0073197599, 9780073197593

More Books

Students also viewed these Databases questions

Question

Describe the signs of poor listening.

Answered: 1 week ago

Question

9. System creates a large, diverse talent pool.

Answered: 1 week ago