Question: Begin with the following structure declaration: struct chaff { char dross[20]; int slag; }; Write a program that uses placement new to place an array
Begin with the following structure declaration:
struct chaff
{
char dross[20];
int slag;
};
Write a program that uses placement new to place an array of two such structures in a buffer.Then assign values to the structure members (remembering to use strcpy() for the char array) and use a loop to display the contents. Option 1 is to use a static array, like that in Listing 9.10, for the buffer. Option 2 is to use regular new to allocate the buffer.
Step by Step Solution
3.23 Rating (167 Votes )
There are 3 Steps involved in it
include struct chaff char dross 20 int slag int main return 0 You create the buff... View full answer
Get step-by-step solutions from verified subject matter experts
