Create a main function and do the following sequence of instructions: a. Declare two integer variables r and s. b. Declare two pointer to an integer variables a and b. c. Assign the following values: r = 50, s = 25 d. Let pointer a points to the address of r. e. Print the value and address of r using a. f. Increment the value of r by 15 using a. g. Let pointer b points to the address of s. h. Print the value and address of s using b. i. Add the value r to the value stored in s using their pointer variables. j. Let a points to the address pointed to by b. k. Change the value of s to 50 using a. l. Print the values and address pointed by a and b.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter12: Points, Classes, Virtual Functions And Abstract Classes
Section: Chapter Questions
Problem 1TF
icon
Related questions
Question

Create a main function and do the following sequence of instructions:
    a. Declare two integer variables r and s.
    b. Declare two pointer to an integer variables a and b.
    c. Assign the following values: r = 50, s = 25
    d. Let pointer a points to the address of r.
    e. Print the value and address of r using a.
    f. Increment the value of r by 15 using a.
    g. Let pointer b points to the address of s.
    h. Print the value and address of s using b.
    i. Add the value r to the value stored in s using their pointer variables.
    j. Let a points to the address pointed to by b.
    k. Change the value of s to 50 using a.
    l. Print the values and address pointed by a and b.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning