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

Which uses less memory?
a)
struct astruct
{
int x;
float y;
int v;
};

b)
union aunion
{
int x;
float v;
};

c)
char array[10];

Answer Posted / jaroosh

And the explanation for the above answer is :
union has the size of the biggest type of its member, so
here its size is 4, while structs size is 4 + 4 + 4 = 16,
and arrays size is 1 * 10 = 10.

Is This Answer Correct ?    10 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

write a corrected statement so that the instruction will work properly. if (4 < x < 11) y = 2 * x;

1967


What are destructors?

959


Which bit wise operator is suitable for checking whether a particular bit is on or off?

988


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: "<

2015


What ANSI C++ function clears the screen a) clrscr() b) clear() c) Its not defined by the ANSI C++ standard

995


What is namespace std; and what is consists of?

1252


Write about the various sections of the executable image?

948


Why is c++ difficult?

1007


Differentiate between the manipulator and setf( ) function?

1127


If a header file is included twice by mistake in the program, will it give any error?

1010


Is c++ a low level language?

935


Is main a class in c++?

976


What is an orthogonal base class in c++?

1116


What is #include c++?

1066


How does code-bloating occur in c++?

1156