Question 2 of 146 points

Question 2 · 6 points

Explain sizeof and array parameters

On a typical 64-bit system, state what Size 1 and Size 2 print and explain why.

struct Data {
    char a;
    double b;
    char c;
};

void analyze_data(struct Data arr[10]) {
    printf("Size 1: %zu\n", sizeof(struct Data));
    printf("Size 2: %zu\n", sizeof(arr));
}

Your explanation must discuss both structure padding/alignment and what happens to an array parameter in a function declaration.

Your response

Your answer

0 words