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
Why double pointer is used in c?
Does c have circular shift operators?
What are the 32 keywords in c?
What does struct node * mean?
What are the advantage of c language?
Explain enumerated types in c language?
What does node * mean?
Can a program have two main functions?
Write a program to reverse a string.
What is variable declaration and definition in c?
What is calloc()?
How can you check to see whether a symbol is defined?
Explain the array representation of a binary tree in C.
How can I implement sets or arrays of bits?
What are the string functions? List some string functions available in c.