Algorithms
October 4, 2023Image-Processing
October 4, 2023Programming
Question 425 |
Suppose you are compiling on a machine with 1-byte chars, 2-byte shorts, 4-byte ints, and 8-byte doubles, and with alignment rules that require the address of every primitive data element to be integer multiple of the element’s size. Suppose further that the compiler is not permitted to reorder fields; padding is used to ensure alignment. How much space will be consumed by the following array?
struct {
short s;
char c;
short t;
char d;
double r;
int i;
}A[10]; /*10 element array of struct*/
struct {
short s;
char c;
short t;
char d;
double r;
int i;
}A[10]; /*10 element array of struct*/
150 bytes | |
320 bytes | |
240 bytes | |
200 bytes |
Correct Answer: C
Subscribe
Login
0 Comments