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

When would you use a pointer to a function?

993


What does char * * argv mean in c?

999


What is the purpose of sprintf?

1067


Explain what are binary trees?

1021


Explain do array subscripts always start with zero?

1175


Explain what header files do I need in order to define the standard library functions I use?

1115


Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?

1201


How can I copy just a portion of a string?

1272


Explain what is wrong with this statement? Myname = ?robin?;

1523


What is register variable in c language?

987


Explain modulus operator. What are the restrictions of a modulus operator?

970


If the size of int data type is two bytes, what is the range of signed int data type?

975


Explain what is output redirection?

1136


What is a pointer value and address in c?

1058


When should structures be passed by values or by references?

995