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
Name the implicit member functions of a class.
Declare a class vehicle and make it an abstract data type.
What are the various situations where a copy constructor is invoked?
Write a program for Divide a number with 2 and Print the output ( NOTE: Check for divide by zero error).
Do we have to use initialization list in spite of the assignment in constructors?
What is class syntax c++?
How do c++ struct differs from the c++ class?
Is sorted c++?
What is the use of 'using' declaration in c++?
What is binary search in c++?
What is the use of string in c++?
What is the basic of c++?
Differentiate between the message and method in c++?
What is ifstream c++?
How does code-bloating occur in c++?