...
Algorithms
October 4, 2023
Image-Processing
October 4, 2023
Algorithms
October 4, 2023
Image-Processing
October 4, 2023

Programming

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*/
A
150 bytes
B
320 bytes
C
240 bytes
D
200 bytes
Correct Answer: C
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!