Why (int* char d) is not printing it's memory address in this code?

Viewed 33

Why int* char d is not printing address of y whereas, c is printing memory address of a? #include using namespace std;

int main () {

int a = 2;   // Initialization of a
int b = 3;   // Initialization of b

char y = 'A';
char z = 'B';

int* c =  &a ;  // c pointing address of a
char* d = &y ;  // d pointing address of y

*c = 32 ;
*d = 'D' ;

cout<< *c <<" "<< *d << endl;  // d is  printing 'D'

cout<< c <<" "<< d << endl;  // d should print memory address instead of 'D'

return 0;
}
0 Answers
Related