Given a data structure with three fields: an array of integers, matrix of real numbers, and a character string. Calculate the total memory size (in bits, bytes, kilobytes, and megabytes) for A record, B table, and C dynamic array variables.

icon
Related questions
Question

Data structure and algorithms in C++

Data types and algorithms. Abstract structures of information.

Task: Given a data structure with three fields: an array of integers, matrix of real numbers, and a character string. Calculate the total memory size (in bits, bytes, kilobytes, and megabytes) for A record, B table, and C dynamic array variables.

note: The data types are respectively equal to the memory size "short - 2 byte", "int - 4", "long - 8", "float - 4", "double - 8", "long double - 12", "char - 1".

 

struct DATA
{
short P1[25];
double P2[7][7];
char P3[78];
} A, B[73], *C;
C=new DATA (21);
Transcribed Image Text:struct DATA { short P1[25]; double P2[7][7]; char P3[78]; } A, B[73], *C; C=new DATA (21);
Expert Solution
Step 1: Given data structure

struct DATA {

short P1 [25];

double P2 [7][7];

char P3 [78];

} A, B[73], *C;

C=new DATA (21);

steps

Step by step

Solved in 7 steps

Blurred answer