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

What is implicit conversion/coercion in c++?

1531


What flag means?

1013


What is a stack c++?

1053


What is the c++ programming language used for?

1095


Which compiler does turbo c++ use?

1136


What is a type library?

1154


Is eclipse good for c++?

1104


What is a hashmap c++?

1158


What is a Default constructor?

1674


Can manipulators fall in love?

1070


I want to write a C++ language program that: 1. Reads in the size of a square from the screen; 2. Prints a hollow square of that size out of “-“, “|” and blanks on screen; 3. Prints the same hollow square onto a text file. The program should work for squares of all side sizes between 1 and 20.

2878


Explain public, protected, private in c++?

1070


Explain terminate() and unexpected() function?

1167


What is object oriented programming (oop)?

1175


If we want that any wildcard characters in the command line arguments should be appropriately expanded, are we required to make any special provision? If yes, which?

1582