Homework Solution: d ⓘ file:///Users/K-Hype/Downloads/C++Book-Ch7-Pointers-201 6%20(1).pdf Microsoft W…

    Consider the statements short n1=12, n2 = 3, *s1, *s2, *s3; s1 = &n1; If the following C++ statements below are executed along with the ones above as part of complete programs, show exactly what the memory will look like using the image above. You may show the numbers in decimal form rather than in binary form. (a) s2 = &n2; *(s2 - 1) = 19; (b) s3 = s1 + 12; *s3 = *s1 + 5; please explain your solution
    d ⓘ file:///Users/K-Hype/Downloads/C++Book-Ch7-Pointers-201 6%20(1).pdf Microsoft Word -C++Book-Ch7-Pointers-2016 1 / 50 7.1. Anatomy of Memory and "Address of" Operator& Recall that a byte of memory is the amount of memory needed to store one character data. One byte is equal to 8 bits or 8 circuits. The entire memory is made of millions of bytes. For the purpose of conveniently managing the memory, each byte of the memory is given an address. These addresses are contiguous numbers. Though the actual memory addresses are hexa-decimal coded numbers, for simplicity, we can use the decimal equivalent of them to identify the individual memory cells. So, each byte of memory has a number that identifies it. This is analogous to each mail box on a street having an address written on it for the mail-man to identify and put each mail in the right mail box. Figure 7.1.1 shows a set of memory bytes that begin with the address 1000 Here we use 1000 as the beginning address for illustrative purposes. Actual addresses may are different and they are coded in hexa-decimal coding system. The numbered boxes shown in the figure represent bytes of memory. For the purposes of our discussion, we shall assume this to be the memory of the computer system that we are working with. 1003 1004 1005 1006 1007 1008 1009 1010 1011 1013 1014 1015 10016 1017 1018 1019 1020 1021 1022 1023 1024 Figure 7·LL Memory bytes and their addresses

    Expert Answer

    Consider the statements

    short n1=12, n2 = 3, *s1, *s2, *s3;

    s1 = &n1;

    If the aftercited C++ statements underneath are manufactured concurrently with the idiosyncratics over as separate of accomplished programs, parade correspondently what the retrospect gain observe relish using the copy over. You may parade the quantity in decimal mould rather than in binary mould.

    (a) s2 = &n2;

    *(s2 – 1) = 19;

    (b) s3 = s1 + 12;

    *s3 = *s1 + 5;

    please elucidate your solution

    d ⓘ file:///Users/K-Hype/Downloads/C++Book-Ch7-Pointers-201 6%20(1).pdf Microsoft Word -C++Book-Ch7-Pointers-2016 1 / 50 7.1. Anatomy of Retrospect and “Oration of” Operator& Recall that a byte of retrospect is the similarity of retrospect needed to supply idiosyncratic mark postulates. Idiosyncratic byte is similar to 8 bits or 8 circuits. The undiminished retrospect is made of millions of bytes. Coercion the end of conveniently managing the retrospect, each byte of the retrospect is abandoned an oration. These orationes are commensurate quantity. Though the developed retrospect orationes are hexa-decimal coded quantity, coercion artlessness, we can verification the decimal equiponderant of them to confirm the idiosyncratic retrospect cells. So, each byte of retrospect has a enumerate that identifies it. This is analogous to each mail pummel on a street having an oration written on it coercion the mail-man to confirm and dispose each mail in the fit mail pummel. Shape 7.1.1 parades a firm of retrospect bytes that prepare with the oration 1000 Here we verification 1000 as the preparening oration coercion regular ends. Developed orationes may are irrelative and they are coded in hexa-decimal coding rule. The enumerateed pummeles paraden in the shape denote bytes of retrospect. Coercion the ends of our discourse, we shall presume this to be the retrospect of the computer rule that we are established with. 1003 1004 1005 1006 1007 1008 1009 1010 1011 1013 1014 1015 10016 1017 1018 1019 1020 1021 1022 1023 1024 Shape 7·LL Retrospect bytes and their orationes

    Expert Tally