#include <iostream> using namespace std; int main() { char variable1 = 'b'; int variable2 = 15; double variable3 = 10.2; char *pntr1 = &variable1; int *pntr2 = &variable2; double *pntr3 = &variable3; cout<<"before changing: "<<endl; cout<<"variable1 value= "<<variable1<<",\t\tAddress: "<<&variable1<<",\t*pntr1 value = "<<*pntr1<<endl; cout<<"variable2 value= "<<variable2<<",\tAddress: "<<&variable2<<",\t*pntr2 = "<<*pntr2<<endl; cout<<"variable3 value= "<<variable3<<",\tAddress: "<<&variable3<<",\t*pntr3 = "<<*pntr3<<endl; *pntr1 = 'c'; *pntr2 = 25; *pntr3 = 12.50; cout<<"____________________"<<endl; cout<<"After changing: "<<endl; cout<<"variable1 value= "<<variable1<<",\t\tAddress: "<<&variable1<<",\t*pntr1 value = "<<*pntr1<<endl; cout<<"variable2 value= "<<variable2<<",\tAddress: "<<&variable2<<",\t*pntr2 = "<<*pntr2<<endl; cout<<"variable3 value= "<<variable3<<",\tAddress: "<<&variable3<<",\t*pntr3 = "<<*pntr3<<endl; return 0; } //OUTPUT: before changing: variable1 value= b, Address: b(b5��, *pntr1 value = b variable2 value= 15, Address: 0x7ffce6356230, *pntr2 = 15 variable3 value= 10.2, Address: 0x7ffce6356228, *pntr3 = 10.2 ____________________ After changing: variable1 value= c, Address: c(b5��, *pntr1 value = c variable2 value= 25, Address: 0x7ffce6356230, *pntr2 = 25 variable3 value= 12.5, Address: 0x7ffce6356228, *pntr3 = 12.5
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter