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...

whats the size of class EXP on 32 bit processor?
class EXP
{
char c1;
char c2;
int i1;
int i2;
char *ptr;
static int mem;
};

Answer Posted / ricardo

The answer is 16 (on most compilers), but not for the
reasons stated above.

If the class contained only c1 and c2, the size would be
2. Since i1 is an integer, though, it needs to be aligned
on a 4-byte multiple. The pointer and the other integer
also uses up 4 bytes. So, the total size is 16.

If there were another character field "c3" adjacent to c2,
the size would still be 16 bytes.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the benefits of c++?

981


Explain the auto storage classes in c++.

1052


What gives the current position of the put pointer?

941


When do we use copy constructors?

1022


what are the characteristics of Class Members in C++?

994


the maximum length of a character constant can be a) 2 b) 1 c) 8

1041


What is searching? Explain linear and binary search.

945


Explain the difference between abstract class and interface in c++?

924


Difference between pointer to constant and constant pointer to a constant. Give example.

1062


can any one help to find a specific string between html tags which is changed to a sting.. weather.html looks (for location) is somewhere #include #include #include using namespace std; string find_field(string myPage,string); int main (void) { string page, line, location, temperature; ifstream inputFile("weather.xml"); while(getline(inputFile, line)) { page.append(line); line.erase(); } // Now page is a string that contains the whole xml page // Here you need to write something that finds and // extracts location and temperature from the XML // data in the string page and stores them in // the strings location and temperature respectively location=find_field(page,"location"); temperature=find_field(page,"temp_c"); cout << "Location: "<

2003


Is swift a good first language?

1000


What is stream and its types in c++?

987


Define basic type of variable used for a different condition in C++?

1046


What is the most useful programming language?

994


What is ios :: in in c++?

999