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
What is a stream water?
What does void main return?
Why string is used in c?
What is line in c preprocessor?
What is wrong in this statement?
Explain how can a program be made to print the line number where an error occurs?
What are the c keywords?
What standard functions are available to manipulate strings?
How many types of arrays are there in c?
given post order,in order construct the corresponding binary tree
Explain what is gets() function?
Explain what is the concatenation operator?
What is the need of structure in c?
How can a program be made to print the name of a source file where an error occurs?
What is data types?