Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!