Thursday, 8 August 2013

When we use sizeof operator on object of that class which do not have any data members. Then what would be the output?

When we use sizeof operator on object of that class which do not have any
data members. Then what would be the output?

Why this always output 1??
class Abhi
{
public :
int sum (int, int);
int avg (int);
};
int Abhi:: sum(int a, int b)
{
float c;
c=a+b;
return 0;
}
int main()
{
Abhi abh;
int c;
c= sizeof(abh);
cout<<c;
}

No comments:

Post a Comment