Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 2) Suppose that the following bytes were in RAM at the addresses shown a

ID: 3585227 • Letter: P

Question

Problem 2)

Suppose that the following bytes were in RAM at the addresses shown and that the characters in “array” start at 0x00001800.

Recall that Microblaze is a “little-endian” device.

0x00001800

0x12

0x00001801

0x4F

0x00001802

0xEF

0x00001803

0xC6

0x00001804

0xA4

0x00001805

0xFE

0x00001806

0x03

0x00001807

0x9D

0x00001808

0x99

0x00001809

0x08

0x0000180a

0x1E

0x0000180b

0x23

0x0000180c

0xF2

0x0000180d

0xAC

0x0000180e

0x7F

0x0000180f

0x57

array[0]                        unsigned char array[16];

     . char *charptr;

    .                                                   

    .                                                   

                                    

If charptr = &array[0x02], what is the value of *charptr?                                 

______________

If charptr = &array[0x0c], what is the value of *charptr?                                 

__________________________

If charptr = &array[0x02], what is the value of charptr++?                             

____________________________

If charptr = &array[0x0c], what is the value of charptr++?

_____________________________

0x00001800

0x12

0x00001801

0x4F

0x00001802

0xEF

0x00001803

0xC6

0x00001804

0xA4

0x00001805

0xFE

0x00001806

0x03

0x00001807

0x9D

0x00001808

0x99

0x00001809

0x08

0x0000180a

0x1E

0x0000180b

0x23

0x0000180c

0xF2

0x0000180d

0xAC

0x0000180e

0x7F

0x0000180f

0x57

Explanation / Answer

array[0x00] =

0x00001800

0x12

If charptr = &array[0x02], what is the value of *charptr?    

array[0x02] =

0x00001802

0xEF

                         

_

&charptr = 0xEF

value of *charptr = 0x00001802

If charptr = &array[0x0c], what is the value of *charptr?         

at array[0x0c]  

0x0000180c

0xF2

                      

hexadecimal c = 12

starting from index 0 , 12th element

*charptr = 0x0000180c

If charptr = &array[0x02], what is the value of charptr++?                             

increment in pointer will move to next address

so charptr++ = &array[0x02] ++

= [0xEF]++ = 0xC6(moving to next 16 characters)

If charptr = &array[0x0c], what is the value of charptr++?

charptr = &array[0x0c]++

= [0xF2]++ = 0xAC

0x00001800

0x12

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote