Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLS CODE IT IN C bPointer bCreate(short size, char increment, char mode) o TODO202 (function header) and TODO203 (function definition). o This function creates a

PLS CODE IT IN C

bPointer bCreate(short size, char increment, char mode) o TODO202 (function header) and TODO203 (function definition). o This function creates a new buffer in memory (on the program heap), trying to allocate memory for one buffer structure using calloc(); o It tries to allocates memory for one dynamic character buffer (content) calling malloc() with the given initial capacity (size); o This function also copies the given size value into the Buffer structure size variable; o NOTE_06: The range of the parameter size must be between 0 and the MAXIMUM ALLOWED POSITIVE VALUE 1 inclusive. The maximum allowed positive value is determined by the data type of the parameter size. o NOTE_07: The range of the parameter increment can vary according to the mode: For FIXMODE, the increment must be always 0,

For ADDMODE the values acceptable are from the range 1 to 255, For MULMODE, the values go from 1 to MAX_INCREMENT (100) inclusive. o If the size is 0, the function tries to create a character buffer with size adjusted to DEFAULT_SIZE (200) characters and increment to DEFAULT_INCREMENT (15). o According to the mode parameter (char), the buffer mode is set (use the constant definitions for this): FIXMODE (0), ADDMODE (1), MULMODE (-1). In the FIXMODE, there is no increment applicable. o With the correct size, the content of buffer (char*) can be created using malloc(). o This function also sets the Buffer structure operational mode indicator mode and the increment. o It also sets the flags field to its default value which is 3FFF hexadecimal (0011.1111.1111.1111 in binary). o Finally, on success, the function returns a pointer to the Buffer structure. It must return NULL pointer on any error which violates the constraints imposed upon the buffer parameters or prevents the creation of a working buffer. o Error Condition_01: If run-time error occurs, the function must return immediately after the error is discovered. Check for all possible errors which can occur at run time. Do not allow memory leaks, dangling pointers, or bad parameters.

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

Database Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

More Books

Students also viewed these Databases questions

Question

What is electric dipole explain with example

Answered: 1 week ago

Question

What is polarization? Describe it with examples.

Answered: 1 week ago

Question

Question Can a Keogh plan fund be reached by the owners creditors?

Answered: 1 week ago

Question

Question What happens to my plan if I die?

Answered: 1 week ago