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 double in c++?
Define a nested class.
Please explain class & object in c++?
What is a static member?
How do you remove an element from a set in c++?
Is c++ the hardest programming language?
Differentiate between an array and a list?
which operator is used for performing an exponential operation a) > b) ^ c) none
When is the copy constructor called?
Which c++ operator cannot overload?
Describe Trees using C++ with an example.
A mXn matrix is given and rows and column are sorted as shown below.Write a function that search a desired entered no in the matrix .with minimum complexity 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Explain what you mean by a pointer.
What is istream and ostream in c++?
How do pointers work?