Question

struct my_coord { int x; int y; double altitude; }; struct my_line { struct my_coord first;...

struct my_coord {
       int x;
       int y;
       double altitude;
     };

     struct my_line {
       struct my_coord first;
       struct my_coord second;
       char name[10];
     };

     struct my_coord var;
     struct my_coord array[3];
     struct my_line one_line;
     struct my_line two_lines[2];
Draw the memory layout of the prior four variables; var, array, one_line,
   and two_lines on a line of boxes.  Label the start of each variable and
   clearly show how many bytes each element within each structure variable
   consumes.
0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
struct my_coord { int x; int y; double altitude; }; struct my_line { struct my_coord first;...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • PLease explain output of these two programs: 1. #include <stdio.h> typedef struct { char *name; int...

    PLease explain output of these two programs: 1. #include <stdio.h> typedef struct { char *name; int x, y; int h, w; } box; typedef struct { unsigned int baud : 5; unsigned int div2 : 1; unsigned int use_external_clock : 1; } flags; int main(int argc, char** argv){ printf("The size of box is %d bytes\n", sizeof(box)); printf("The size of flags is %d bytes\n", sizeof(flags)); return 0; } 2. #include <stdio.h> #include <string.h> /* define simple structure */ struct { unsigned...

  • Declare a struct worker with the following attributes: char array first name string surname int age...

    Declare a struct worker with the following attributes: char array first name string surname int age double salary. then , declare a structure my worker which is of type worker. ( read carefully, don,t make a mistake! ) one line is needed for the answer. in c programming

  • C programming language 4. (Memory allocation) Consider typedef struct char name [20]; int balance; int gain;...

    C programming language 4. (Memory allocation) Consider typedef struct char name [20]; int balance; int gain; ) Player; int ni Player pi scanf ("%d", &n); Complete the code above by allocating a memory for n players each of which of type Player and making p point to the start of that memory (or in other words, making p have the value of the starting address of that memory). [Recall the slides on dynamic memory allocation function malloc.]

  • #include <stdio.h> int main(int argc, char *argv[]) {      char a, *pc, c[9];      int i, *pk, k[9];      a='...

    #include <stdio.h> int main(int argc, char *argv[]) {      char a, *pc, c[9];      int i, *pk, k[9];      a='z';      pc=&(c[8]);      pk=&(k[0]);      for (i=0; i<9; i++)     {           *pc=a-(char)i;           pc--;           *pk=(int)a-i;           pk++;           }                     return 0; }//end of main Answer the below questions with the above code Write out the memory map for the above C code in the following table. For array variables, list the address range for the entire array. Assume the memory address starts from 100, that is, the address for a...

  • struct nameType { string first; string last; }; struct studentType { nameType name; double gpa; };...

    struct nameType { string first; string last; }; struct studentType { nameType name; double gpa; }; a. Write a program that declares an array of the studentType structure, size 10, name of your choice, and includes the following: • Write a void function to request user input into each of the members of the studentType structure array. Be sure to include proper user prompts. Assume the entire structure array is filled. Write the prototype and the function definition. • Call...

  • The structure Car is declared as follows: struct Car { string carMake; string carModel; int yearModel;...

    The structure Car is declared as follows: struct Car { string carMake; string carModel; int yearModel; double cost; }; Write a definition statement that defines a Car structure variable initialized with the following data: Make: Ford Model: Mustang Year Model: 1968 Cost: $20,000 THEN Define an array of 25 of the Car structure variables

  • Consider the following statements: struct nameType { string first; string last; }; struct courseType { string...

    Consider the following statements: struct nameType { string first; string last; }; struct courseType { string name; int callNum; int credits; char grade; }; struct studentType { nameType name; double gpa; courseType course; }; studentType student; studentType classList[100]; courseType course; nameType name; Mark the following statements as valid or invalid. If a statement is invalid, explain why. student.course.callNum = "CSC230"; cin >> student.name; classList[0] = name; classList[1].gpa = 3.45; name = classList[15].name; student.name = name; cout << classList[10] << endl;...

  • int c = 75; int d = 100; int& r1 = c; int& r2 = d;...

    int c = 75; int d = 100; int& r1 = c; int& r2 = d; c++; r2++; Use the code above. Suppose the variable c lives at memory address 512, and d lives at the memory address 1024. The size of an integer is 4 bytes. After execution of the above code, draw labelled boxes for each of the 4 variables c, d, r1 and r2, and show their integer values. For r1 and r2, draw an additional arrow...

  • Cache performance The starting code would have: struct position { int x; int y; } int...

    Cache performance The starting code would have: struct position { int x; int y; } int N; struct position grid[N][N]; int totalX=0; int totalY=0; int i, j; //For X loop for( i = 0; i < N; i ++){ for( j = 0; j < N; j++){ totalX += grid[i][j].x; } } //For Y loop for( j = 0; j < N; j++){ for( i = 0; i < N; i++){ totalY += grid[i][j].y; } } Part I: This part...

  • Homework Part 1 Write a C program that declares and initializes a double, an int, and a char. You...

    Homework Part 1 Write a C program that declares and initializes a double, an int, and a char. You can initialize the variables to any legal value of your choosing. Next, declare and initialize a pointer variable to each of the variables Using printf), output the following: The address of each of the first three variables. Use the "Ox%x" format specifier to print the addresses in hexadecimal notation The value of each variable. They should equal the value you gave...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT