Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the following structure: struct Category std::string cat Name: char *types: short *counts: size_t countsize, typeSize: Write a function that accepts a pointer to a

image text in transcribed
Given the following structure: struct Category std::string cat Name: char *types: short *counts: size_t countsize, typeSize: Write a function that accepts a pointer to a struct of the type Category (as seen). This function uses the pointer to the existing Category struct and rewrites the information to a new one by taking the data from the one passed and rewriting the fields. The function should copy the name to the new struct, copy the types and now make the types twice the size of the one passed, and copy the counts and now make the counts twice the size of the one that was passed. For each expanded array, Initialize the empty information with the valid default info for that type. Notes: The count size and type size are doubled for the new struct. The new struct that we are making is dynamically allocated, and the return type of the function is a pointer. Make sure to return the new struct's pointer. Write the CODE HERE heginning with the function badan Given the following structure: struct Category std::string cat Name: char *types: short *counts: size_t countsize, typeSize: Write a function that accepts a pointer to a struct of the type Category (as seen). This function uses the pointer to the existing Category struct and rewrites the information to a new one by taking the data from the one passed and rewriting the fields. The function should copy the name to the new struct, copy the types and now make the types twice the size of the one passed, and copy the counts and now make the counts twice the size of the one that was passed. For each expanded array, Initialize the empty information with the valid default info for that type. Notes: The count size and type size are doubled for the new struct. The new struct that we are making is dynamically allocated, and the return type of the function is a pointer. Make sure to return the new struct's pointer. Write the CODE HERE heginning with the function badan

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

More Books

Students also viewed these Databases questions

Question

1. Who will you assemble on the team?

Answered: 1 week ago

Question

Did the team members feel that their work mattered

Answered: 1 week ago