Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

In c malloc allocate contiguos or non contiguos memory allocation ?

And how we use that memory?

user-image
Question ajoutée par mayur agarwal
Date de publication: 2013/09/30
Muhammed Ajmal Seeraveetil
par Muhammed Ajmal Seeraveetil , Software Engineer , Wipro

 

      void *ptr= malloc (20);

      int *iptr= (int *)ptr; //4 byte access  

      char *cptr=(char *)ptr; // Single byte access 

  • Malloc allocates contigous block of memory  
  • Memory is alocated from heap 
  • Memory can be used by typcasting the void pointer returned by the malloc 

malloc/calloc both functions allocate memory in one contigous block

KASHIF ZEESHAN
par KASHIF ZEESHAN , Corporate Trainer , ORION EDUTECH PVT LTD

Non Contagious

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?