Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Example 1 : Pointers #include using namespace std; int main ( ) { int * pc , c; c = 5 ; cout < <

Example 1: Pointers
#include
using namespace std;
int main(){
int *pc, c;
c =5;
cout << "Address of c (&c): "<< &c << endl;
cout << "Value of c (c): "<< c << endl << endl;
pc = &c; // Pointer pc holds the memory address of variable c
cout << "Address that pointer pc holds (pc): "<< pc << endl;
cout << "Content of the address pointer pc holds (*pc): "<<*pc << endl << endl;
c =11; // The content inside memory address &c is changed from 5 to 11.
cout << "Address pointer pc holds (pc): "<< pc << endl;
cout << "Content of the address pointer pc holds (*pc): "<<*pc << endl << endl;
*pc =2;
cout << "Address of c (&c): "<< &c << endl;
cout << "Value of c (c): "<< c << endl << endl;
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions

Question

Typography can be defined as the process of selecting all EXCEPT:

Answered: 1 week ago

Question

=+6. Whether they'd talk to others about the ad.

Answered: 1 week ago