Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is the size of this class
class size
{
public:
char data1;
double d;
int data2;
char data3;
double data4;
short data5;
};

please explain the padding for these double variables.

Answer Posted / ada

I tried sizeof() the class and the output is 40 bytes. I
think the padding maybe like this:

char data1 1+7 bytes
double d 8 bytes
int data2 4 bytes char data3 1+3 bytes
double data4 8 bytes
short data5 2+6 bytes

So totally 5x8=40 bytes

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why Pointers are not used in C++?

1020


Write about the scope resolution operator?

983


How do you declare A pointer to a function which receives nothing and returns nothing

1175


What do you understand by a pure virtual member function?

942


Define pure virtual function?

935


What is a class template in c++?

1005


Search for: what is pair in c++?

1070


the first character in the variable name must be an a) special symbol b) number c) alphabet

1042


What is pointer with example?

980


how to access grid view row?

2170


Eplain extern keyword?

979


What is token c++?

983


Who calls main function?

1055


What is a class definition?

1013


What is a flag in c++?

1012