Question: #include #include #include #include int dummy_function(int i, long j){ return i&(~j); } int main(){ char* str = Failure is simply the opportunity to begin again,

#include  #include  #include  #include  int dummy_function(int i, long j){ return i&(~j); } int main(){ char* str = "Failure is simply the opportunity to begin again, this time more intelligently."; int myint = INT_MAX - 26; long mylong = LONG_MIN + 2570; struct S7 { int i; int j; char c; }; struct S7 s; struct S7 r[12]; int *ptr_int = (int *)str+9; long *ptr_long = (long *)str+3; printf("%d", dummy_function(*ptr_int,*ptr_long)); return 0; }

1. What is the address of the character string pointed to by str?

2. What is the word that starts at address str+0x24 ?

3. What is the address where variable myint is stored?

4. What is the address of the leftmost (or highest order) byte of myint? (Hint: the leftmost byte is 0x7f)

5. What is the address of the leftmost (or highest order) byte of mylong?

6.

The source code declares the following struct:

struct S7 { int i; int j; char c; };

We also have an array of structures, declared as struct S7 r[12].

What is the size of the array r in bytes?

How many bytes is one instance of the struct S7?

Given the declaration of the struct above, we might expect the size of each element of the array (which is a struct with 2 int and 1 char) to be 4bytes * 2 + 1byte = 9 bytes. Is the size reported in Q6.2 different? If yes, what causes this difference in size?

What is the address where r[4].j is located?

what is the address where r[7].c is located?

The code also contains a function with signature dummy_function(int i, long j). Line 21 of the source code contains a call to this function. Identify the parameters and the registers used as arguments for this call by looking at the assembly code

Which register contains the first argument?

What is the value passed in this register (as hex) for the first argument?

Which register contains the second argument?

What is the value passed in this register (as hex) for the second argument?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!