Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

when u declare a structure there is no memory allocated yet.
memory will be allocated after creating an
instance(variable).Here, there is an instance (pointer
variable pointing to structure FAQ ). But the compiler
allocated only 4 bytes of memory for the variable temp. But
the this temp contains garbage address or 0 if it is
global. to allocated memory of size 60 byte u need to use
malloc function.

Ex: temp = malloc ( sizeof ( struct FAQ ) );

now 60 bytes of memory has been allocated from the heap. and
the starting address of this memory chunk is stored in
variable temp.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is operator promotion?

1058


Why do we need volatile in c?

1164


what is stack , heap ,code segment,and data segment

2690


Why static variable is used in c?

1033


Explain about the functions strcat() and strcmp()?

1044


Can we declare variable anywhere in c?

965


Explain threaded binary trees?

1153


What is equivalent to ++i+++j?

1088


I just typed in this program, and it is acting strangely. Can you see anything wrong with it?

1001


What is string function c?

1014


what are the facialities provided by you after the selection of the student.

2250


What is the use of clrscr?

1101


Can stdout be forced to print somewhere other than the screen?

1044


Why c is procedure oriented?

1066


the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters

2292