Based on the codes given in Program-4, illustrate the memory address of the po current values for variables a, b and c: = S : #include using namespace std; int main() { int a-5, b=10, c=15; int *ptr = &b; cout << "a, b and c values: \n"; cout << a << " " << b << " " << c << endl; ntr

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter10: Pointers
Section: Chapter Questions
Problem 3PP
icon
Related questions
Question
a) Based on the codes given in Program-4, illustrate the memory address of the pointers and
current values for variables a, b and c:
#include <iostream>
2 using namespace std;
NITT P P P
8789SCWN HOODWNH
3
10
11
12
13
14
5 {
15
16
17
18
int main()
19
20 }
int a=5, b=10, c=15;
int *ptr = &b;
cout << "a, b and c values: \n";
cout <<a << "" << b << "" << c << endl;
ptr
= &a;
*ptr *= 2;
ptr = &b;
*ptr *= 2;
ptr
= &C;
*ptr *= 2;
cout << "a, b and c values: \n";
cout << a << "
" << b <<
cout << *ptr value:
return 0;
11
<< c << endl;
<< *ptr << endl;
Program-4
Transcribed Image Text:a) Based on the codes given in Program-4, illustrate the memory address of the pointers and current values for variables a, b and c: #include <iostream> 2 using namespace std; NITT P P P 8789SCWN HOODWNH 3 10 11 12 13 14 5 { 15 16 17 18 int main() 19 20 } int a=5, b=10, c=15; int *ptr = &b; cout << "a, b and c values: \n"; cout <<a << "" << b << "" << c << endl; ptr = &a; *ptr *= 2; ptr = &b; *ptr *= 2; ptr = &C; *ptr *= 2; cout << "a, b and c values: \n"; cout << a << " " << b << cout << *ptr value: return 0; 11 << c << endl; << *ptr << endl; Program-4
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
ADT and Class
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++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
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