Question: in c language COMP SCI 1201/MECH ENG 110x Introduction to Programming for Engineers Sem 1, Q1-4 marks Write a function called mystramp that has a

 in c language COMP SCI 1201/MECH ENG 110x Introduction to Programming

in c language

COMP SCI 1201/MECH ENG 110x Introduction to Programming for Engineers Sem 1, Q1-4 marks Write a function called mystramp that has a similar behavior as the function strcmp defined in the string h library. Note you must write the code yourself, you can't call the stremp or strncmp function in string h but you can use any other functions from string h in your code int mystremp(char stri(), char str2(]) Compares the string pointed to by stri to the string pointed to by str if the returned value is not 0 then it indicates stri is not equal to str2. .if the returned value is 0 then it indicates stri is equal to str2. Use the following driver to test your function (your function must be able to work with this driver and you must demonstrate it working with this driver to the supervisor marking you) #include int main(void) ( char sil)"hello": char s201"world; char s3"hello"; char s4"hellp"; char s51 int test 0; if (nystrcmp(s1, s2) 10)( printf("detects different stringsn"); test++; if (nystrcmp(s1, s3) 0) ( printf("detects same stringsn") test++; if (mystrcmp(s1, s4) 0) ( printf("checks all characters "); test++; if (mystremp(si, s5) 0) f rintf("checks different length stringsin"); test++; tests ", test); printf(" Passed %d of 4

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!