Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

not allow to use string.h test it in mystring_main.c Question 1 My string functions Write C program mystring.h containing the headers of following string functions,

image text in transcribednot allow to use string.h
image text in transcribed
test it in mystring_main.c
image text in transcribed
Question 1 My string functions Write C program mystring.h containing the headers of following string functions, and mystring.c containing the implementations of the functions. It is not allowed to use string library string.h 1. int str_length(char *s) computes and returns the number of characters of string passed by s (including space). 2. int word_count(char *s) computes and returns the number of words of string passed by s. 3. void lower_case(char *s) changes upper case to lower case of string passed by s. 4. void trim(char *s) removes the none necessary empty spaces of string passed by s. Use the provided main function mystring_main.c to test the above functions, the output should be exactly like the following. Public test gee mystring. c mystring_main. c -o q1 91 str: This Is a Test str length(str):25 word_count (str):4 trim(str): this is a test str length(trim(str)):14 mystring.h Add code comment each function Binder MYSTRING H #define MYSTRING_H int str length (char*): Int word_count (char void lower case (char*): void trim(char*); Fendit mystring.c #include "mystring.h" #define NULLO int str_length(char *s) { your lewentation int word count (char *s) pour implementation void lower_case(char *s) your implementation void trim(char*) ur plementation *mystring_main:c - C# (F) (E) (0) (V) (H) TE #include #include "mystring.h" I int main(int argc, char* args[]) { setbuf(stdout, NULL); char str[100] = This Is a Test "; printf("str:\"%s\" ", str); printf("str_length(str):%d ", str_length(str)); printf("word_count(str):%d ", word_count(str)); trim(str); lower_case(str); printf("trim(str):\"%s\" ", str); printf("str_length(trim(str)):%d ", str_length(str)); return 0; }

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

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions

Question

please dont use chat gpt AI 3 9 0 .

Answered: 1 week ago