Menu

[Solved]7 Consider Following Code Segment Void Foo Int B B 01 42 Int Main Int Arr 81 Foo Arr Label Q37224817

7. Consider the following code segment: Void foo (int *b) B[01-42 Int main () Int arr[81 Foo (arr)

Label the following stack diagram-from the perspective of function foo-each element of the array should be clearly marked. As

8. Consider the following code segments. Struct some Int ai Long b; Char c Int bar (struct some s Int bar (struct some s) S->

9. Consider the following code segment: Struct some Int a; Long b; Char ci Void foo (struct some s) S.a21; S.b 1989 Int main

Please answer in x86-64 version. Trying to learn and undertandthese. Thanks,

7. Consider the following code segment: Void foo (int *b) B[01-42 Int main () Int arr[81 Foo (arr) Label the following stack diagram-from the perspective of function foo-each element of the array should be clearly marked. Assume 8 byte wide words. 0x060 0x068 0x070 0x078 0x080 0x088 0x090 0x098 0x100 0x108 Old base pointer Return address 8. Consider the following code segments. Struct some Int ai Long b; Char c Int bar (struct some s Int bar (struct some s) S->a- 99; S->b 1000; S.a-42; S.b 1337; Int main Int main () Struct some Bar (thing); Printf(“%d, thing; Struct some thing; Bar (&thing); Printf(“%d, %d, %c”, %d, %c”, Thing.a, thing.b, thing.c); Thing.a, thing.b, thing.c) Output: Fill in the expected output when executing the code segments. If the output is different, explain why the results differ. What underlying mechanisms cause this output? Explain thoroughly 9. Consider the following code segment: Struct some Int a; Long b; Char ci Void foo (struct some s) S.a21; S.b 1989 Int main () Struct some thing; Foo (thing) Label the following stack diagram-from the perspective of function foo-each field of the struct should be clearly marked. Assume 8 byte wide words 0x060 0x068 0x070 0x078 0x080 0x088 0x090 0x098 0x100 0x108 Old base pointer Return address Show transcribed image text 7. Consider the following code segment: Void foo (int *b) B[01-42 Int main () Int arr[81 Foo (arr)
Label the following stack diagram-from the perspective of function foo-each element of the array should be clearly marked. Assume 8 byte wide words. 0x060 0x068 0x070 0x078 0x080 0x088 0x090 0x098 0x100 0x108 Old base pointer Return address
8. Consider the following code segments. Struct some Int ai Long b; Char c Int bar (struct some s Int bar (struct some s) S->a- 99; S->b 1000; S.a-42; S.b 1337; Int main Int main () Struct some Bar (thing); Printf(“%d, thing; Struct some thing; Bar (&thing); Printf(“%d, %d, %c”, %d, %c”, Thing.a, thing.b, thing.c); Thing.a, thing.b, thing.c) Output: Fill in the expected output when executing the code segments. If the output is different, explain why the results differ. What underlying mechanisms cause this output? Explain thoroughly
9. Consider the following code segment: Struct some Int a; Long b; Char ci Void foo (struct some s) S.a21; S.b 1989 Int main () Struct some thing; Foo (thing) Label the following stack diagram-from the perspective of function foo-each field of the struct should be clearly marked. Assume 8 byte wide words 0x060 0x068 0x070 0x078 0x080 0x088 0x090 0x098 0x100 0x108 Old base pointer Return address

Expert Answer


Answer to 7. Consider the following code segment: Void foo (int *b) B[01-42 Int main () Int arr[81 Foo (arr) Label the following s… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *