Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 3 Lnai 9286

Authors: Albert Bifet ,Michael May ,Bianca Zadrozny ,Ricard Gavalda ,Dino Pedreschi ,Francesco Bonchi ,Jaime Cardoso ,Myra Spiliopoulou

1st Edition

3319234609, 978-3319234601

More Books

Students also viewed these Databases questions

Question

Question Can a self-employed person adopt a profit sharing plan?

Answered: 1 week ago