Question: HELP! Please help me write the following code in C (NOT C++). Please do not hand-write this on paper, so I can test/modify the code.

HELP! Please help me write the following code in C (NOT C++). Please do not hand-write this on paper, so I can test/modify the code. Feel free to ask any questions, and seperate different functions as if they were in seperate files, include the main() function to test the 5 functions as requested.

Thanks!!

=====================================================================================================

HELP! Please help me write the following code in C (NOT C++).

Please do not hand-write this on paper, so I can test/modify the

We are now ready to begin writing our own string library. We will begin by making a handle type and the bookends, an init default function for my, string and a destroy function Create a new handle type for our string type by simply adding a line to our my string.b file that renames void" to be MY_STRING. MY_STRING will then become the type for any handle holding on to one of our my string opaque objects Next, add the following declarations to your header file //Precondition: None //Postcondition: Allocate space for a string object that represents the empty // string. The string will have capacity 7 and size 0 by default. A copy of // the address of the opaque object will be returned on success and NULL on // failure MY STRING Attempt to build this code using stub functions in the implementation file and then continue Write the corresponding definitions for these functions along with a definition for the internal structure of the MXastAng object in your 00ustung implementation file so that the pre and postconditions are satisfied. The internal object, much like vector, has three parts: An integer, size, representing the number of characters the string currently holds, an integer, capacity, representing the number of characters the string CAN hold and a character pointer, data, that will hold the dynamic array of characters representing a given string Add another initialization function to your code that will allow your users to initialize a string object so that it has the same value as any given c-string. This function will have the following declaration: //Precendtign: sstring is a valid null terminated c-string //Postcondition: Allocate space for a string object that represents a string // with the same value as the given c-string. The capacity of the string // object will be set to be one greater than is required to hold the string // As an example, the string "the" would set capacity at 4 instead of 3. A // copy of the address of the opaque object will be returned on success and // NULL on failure MY STRING char* c string)

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!