Here in this program I am using the volatile register object,
Am I actually storing my object to a register here?
Why am I getting the address of object as 1?
Please share you thought on this.
#include <iostream>
using namespace std;
class a{
int i,j,k[999];
long double arr[9999999];
public:
a(){
i=77; j=89;
cout<<"\nctor\n";
}
void disp()volatile {
cout<<"\ni = "<<i<<" j = "<<j<<"\n";
// delete this;
}
~a(){
cout<<"\ndtor\n";
}
};
int main(){
register volatile a *ao = new a;
cout<<"address of a = "<<ao; //out puts "1" for me; (My processor is core i3 330M).
ao->disp();
delete ao;
}