#include<iostream>
using namespace std;
int main(){
int a=1025;
int *p=&a;
cout<<"Size of integer is: "<<sizeof(int)<<" bytes"<<endl;
cout<<"Address= "<<p<<" Value= "<<*p<<endl;
char *p0;
p0=(char*)p;
cout<<"Size of char is: "<<sizeof(char)<<" bytes"<<endl;
cout<<"Address= "<<p0<<"Value= "<<*p0<<endl;
cout<<"It printed smilie above";
return 0;
}
Why is the address and value of char printed as a smilie?
The output I got is:
Size of integer is: 4 bytes
Address= 0x61ff04 Value= 1025
Size of char is: 1 bytes
Address= ☺♦Value= ☺