let's take a code

struct FAQ
{
int a;
char b;
float c;
double d;
int a[10];
}*temp;

now explain me how the memory will be allocated for the
structure FAQ and what address will be in the structure
pointer (temp)....................

Answer Posted / vrushali

Memory allocated will be word aligned in nature.
e.g. for int the address would be allocated as a multiple of
4 .... Next char would start the n+1 where n = multiple of 4.

Similarly next....
when we do sizeof structure we get 60 bytes...
But originally , it should be
4 + 1+ 4+ 8 + 4 *10 = 57 bytes.
The extra three bytes are from char where 3 bytes are wasted
in memory space.

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.

1533


If null and 0 are equivalent as null pointer constants, which should I use?

583


Why do we need functions in c?

565


difference between native and cross compilers

1673


How can you tell whether two strings are the same?

836






Does free set pointer to null?

567


How can I invoke another program or command and trap its output?

621


What is the difference between test design and test case design?

1575


I need a sort of an approximate strcmp routine?

663


The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?

669


what is the significance of static storage class specifier?

1667


How can I insert or delete a line (or record) in the middle of a file?

579


What is meant by operator precedence?

680


Explain high-order bytes.

678


Why we not create function inside function.

1753