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 the size of structure in c?
Is linux written in c?
I have a varargs function which accepts a float parameter?
Explain what is the difference between a string and an array?
What is a volatile keyword in c?
How are 16- and 32-bit numbers stored?
What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?
What is nested structure with example?
What is string length in c?
What does the format %10.2 mean when included in a printf statement?
What are the functions to open and close file in c language?
What is the use of #define preprocessor in c?
What are pragmas and what are they good for?
Write the program with at least two functions to solve the following problem. The members of the board of a small university are considering voting for a pay increase for their 10 faculty members. They are considering a pay increase of 8%. Write a program that will prompt for and accept the current salary for each of the faculty members, then calculate and display their individual pay increases. At the end of the program, print the total faculty payroll before and after the pay increase, and the total pay increase involved.
Why cant I open a file by its explicit path?