shrikant auti


{ City } nerul
< Country > india
* Profession * navi mumbai
User No # 49774
Total Questions Posted # 0
Total Answers Posted # 3

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 24
Users Marked my Answers as Wrong # 3
Questions / { shrikant auti }
Questions Answers Category Views Company eMail




Answers / { shrikant auti }

Question { 10291 }

which one is better structure or union?(other than the
space occupied )


Answer

strucure is always better than union.
there are to reasons
1.
union occupies incorrect memory.
e.g.
if the lower memory space data is preceeded by higher one.
Then memory should be alloted is addition of these two, but
the memory will be alloted will be any one out of higher
and lower there is no way to assure what memory would be
occupied.

2.
the data given in union is not necessarily be(maybe/may not
be) extreacted properly.
but in structure correct amount of memory space will be
occupied and extracting element is easy.

Is This Answer Correct ?    13 Yes 2 No

Question { 4564 }

union
{
char ch[10];
short s;
}test;
test.s = 0xabcd;


main()
{
printf("%d",ch[10]);
}


Answer

The code written is incorrect......
union
{
char ch[10];
short s;
}test;
test.s = 0xabcd;


main()
{
printf("%d",ch[10]);/*%D CAN'T BE USED FOR CHARACTER
EXTRACTION*/
}

Is This Answer Correct ?    3 Yes 1 No


Question { 3389 }

enum
{
SUNDAY,
MONDAY,
TUESDAY,
}day;
main()
{
day =20;

printf("%d",);
getch();
}
what will be the output of the above program


Answer

If u observe the program carefully,you will come to know
ther is syntax error.
enum
{
SUNDAY,
MONDAY,
TUESDAY,
}day;
main()
{
day =20;

printf("%d",);//printf("%d",) error maker
getch();
}

If u put it
printf("%d",day);
then it will print 20 because 20 is the latest value
assigned for day.

Is This Answer Correct ?    8 Yes 0 No