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
How arrays can be passed to a user defined function
Using which language Test cases are added in .ptu file of RTRT unit testing???
What is local and global variable in c?
I need a sort of an approximate strcmp routine?
What are the functions to open and close file in c language?
What's the right way to use errno?
State the difference between x3 and x[3].
What is linear search?
How do you determine whether to use a stream function or a low-level function?
Write a program which returns the first non repetitive character in the string?
What are dangling pointers? How are dangling pointers different from memory leaks?
int far *near * p; means
What is array within structure?
Explain function?
What are the types of type specifiers?