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 / ranjeet garodia
Jaroosh u r right while calculating the size...
but if u take size of int as 2 then astruct size will be
2+4+2=8
array = 1*10= 10
so c is correct
if size of int is 4, then
struct size will be 4+4+4= 12
then a is correct.
| Is This Answer Correct ? | 1 Yes | 11 No |
Post New Answer View All Answers
What is else syntax in c++?
If all is successful, what should main return a) 0 b) 1 c) void
What does ios :: app do in c++?
What is the difference between a template and a macro?
What is double in c++?
Describe private, protected and public?
Why is c++ called oops?
What is difference between array and vector in c++?
What are the benefits of oop in c++?
Is c++ still in demand?
Declare a class vehicle and make it an abstract data type.
Is swift better than c++?
Write a program which uses Command Line Arguments
What do you mean by “this” pointer?
Is string an object in c++?