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 / reachhary

As already told by vrushali memory to a structure is always
allocated along word boundaries. So int would fetch 4 bytes
(assumed that the int in ur machine takes 4 and word is 4
bytes). Similarly char would take 1 but since the next entry
i.e. float requires 4 so char would be given 4 (3 extra )
and so on for the remaining summing upto 60 as already
indicated.

By default temp would have the base address of the structure
i.e. pointing to the first integer i.e. 'a' in our case.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can a number be converted to a string?

595


Compare array data type to pointer data type

596


What kind of structure is a house?

551


Is c high or low level?

577


Are there constructors in c?

591






What is character set?

681


What are c preprocessors?

672


Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.

617


console I/O functions means a) the I/O operations done on disk b) the I/O operations done in all parts c) the input given through keyboard is displayed VDU screen d) none of the above

653


Is it fine to write void main () or main () in c?

543


Is main an identifier in c?

595


Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above

656


What is the general form of function in c?

607


What are the benefits of organizational structure?

568


Can an array be an Ivalue?

659