Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1/ gcc -Wall memsize.c -o /tmp/memsize && /tmp/memsize #include #define N 1000 typedef struct char x; long y; char 2; } sl_t; typedef struct char
1/ gcc -Wall memsize.c -o /tmp/memsize && /tmp/memsize #include #define N 1000 typedef struct char x; long y; char 2; } sl_t; typedef struct char x; int y; char Z; }32_t; typedef struct { int vals(N); 33_t; static void func1(83_t param) { param.vals[0] - 200; 3 static void func2(33_t *param) { param->vals[0] = 200; 3 int main(int argc, char *argv[]) { 33 t 33; S3_t 34; long long k; printf ("Size(char) %d ", sizeof (char)); printf ("Size (short) ld ", sizeof(short)); printf ("Size (int) = %ld ", sizeof(int)); printf ("Size (long) %d ", sizeof(long)); printf ("Size (long long) = %ld ", sizeof()); printf ("Size (void *) %d ", sizeof (void *)); printf ("Size (s1_t) printf ("Size (32_t) = $10 ", sizeof ($1_t)); $10 ", sizeof ($2_t)); %d ", 33.vals[0]); 33. vals[0] = 100; func1(33); printf("93.vals[0] 34.vals[0] - 100; func2(&$4); printf ("84.vals (0) = %d ", 34.vals[0]); return 0; 2. Now, type it in, compile and run it on a fox machine. Fill in the results here. (2 points each, total 20 points) Size(char) Size(short) = Size(int) = Size(long) = Size(long long) = Size(void *) = Size(s1_t) = Size(s2_t) = 53.vals[0] = 54.vals[0] = 3. Explain the values you got for s1_t and s2_t. Hint: padding. (10 points) | 4. What is the significance of the difference between s3.vals[0] and 54.vals[0]? Which is faster? (10 points)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started