ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

In c malloc allocate contiguos or non contiguos memory allocation ?

And how we use that memory?

user-image
تم إضافة السؤال من قبل mayur agarwal
تاريخ النشر: 2013/09/30
Muhammed Ajmal Seeraveetil
من قبل 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 

durga lakshmi k
من قبل durga lakshmi k

malloc/calloc both functions allocate memory in one contigous block

KASHIF ZEESHAN
من قبل KASHIF ZEESHAN , Corporate Trainer , ORION EDUTECH PVT LTD

Non Contagious

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟