nsu.blackboard.com CSC 260 Laboratory 7 Spring 2017 Pointers Instructions: Submi
ID: 3729733 • Letter: N
Question
nsu.blackboard.com CSC 260 Laboratory 7 Spring 2017 Pointers Instructions: Submit to this page (from Part I) with your answers to your TA. Submit the C++ program from Part Il to the Blackboard. Part Pointers to variables or places in RAM (Random Access Memory) are memory addresses- the address of the byte of memory to which the pointer is referring (or "referencing"). Some programming languages use pointers to increase efficiency, to make changes to variables indirectly, etc. In C++, if Z is an integer variable, then&Z; is the memory address of that variable. For example if we int z = 100 coutExplanation / Answer
Answer:
Q.1. Dev C++ ( I have tested the given code in Dev C++ compiler)
Q.2. 0x6ffe34 (P has the Address of B)
0x6ffe38
(After P++ (P++ means P=P+1), the Address becomes 0x6ffe34+1*4=0x6ffe38, because In DEV C++ compiler the size of integer is 4 bytes, As the address is an Hexadecimal Integer it gets Incremented by 4 bytes)
Q.3. 4 bytes
Q.4. P is the Memory address of A (After P++ or After line 7)
P is the Memory address of B (Before P++ or Before line 7)
Q.5. *q has the new value 42146120
(The new value of *q (42146120) is the value after subtraction of 200 from old *q (42146320))
Q.6. The value of variable A + *P is 900
(The pointer variable P stores the address of A, *P is the value 650, *P=*P-200 gives 450 and that will be stored in *P, that is P points to A, So the value of A is 450. A+ *P is 450 + 450 =900)
Q.7. (*pairptr).I
pairptr->I
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.