question archive In this question, you are going to assume the following data type and its corresponding sizes: char: 1 byte and int: 3 bytes

In this question, you are going to assume the following data type and its corresponding sizes: char: 1 byte and int: 3 bytes

Subject:Computer SciencePrice: Bought3

In this question, you are going to assume the following data type and its corresponding sizes: char: 1 byte and int: 3 bytes. From a C-like snippet of a code below, answer the rest of this questions. Note: use a lost of casting in the second half of this snippet to make sure things are clearly declared. typedef struct type1{int i[3];} typeA; typedef struct type2{typeA j[2];} typeB; typeA *a; typeB *b; unsigned long *c; int i; a = malloc(2*sizeof(typeB)); b = a; c = a; for(i=0;i<18;i++) { *(c+i) = (unsigned char)(i%8); } Assuming that the actual location of a after malloc is called is at the physical address 0x10000 in DRAM. Using the concept of address we learn from our class, the table below shows our DRAM starting from the address 0x10000. Please put in the values inside each bytes in our DRAM starting at address 0x10000 up to the end of where a is malloced for. Write XX in the byte that is unknown/unassigned, and write YY on the byte that is not in the range that a covers. I gave you the first byte, finish the rest. Hint: Draw the organization of the struct out on a piece of paper. Pair this up with the concept of an array and type casting. This question is actually very easy but you need to be a bit careful. Hint2: Please note that our table is actually 1D. Each row is 8 bytes in size and the address of the next row basically continue from the end of the earlier row. I just have no method to draw a very long 1D table so I need to resort to a 2D table here. 

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE