About 6,580,000 results
Open links in new tab
  1. When and why to use malloc - Stack Overflow

    56 You use malloc when you need to allocate objects that must exist beyond the lifetime of execution of the current block (where a copy-on-return would be expensive as well), or if you …

  2. c - Difference between malloc and calloc? - Stack Overflow

    Oct 8, 2009 · malloc() and calloc() are functions from the C standard library that allow dynamic memory allocation, meaning that they both allow memory allocation during runtime.

  3. c++ - How do malloc () and free () work? - Stack Overflow

    Jul 13, 2009 · malloc () is system/compiler dependent so it's hard to give a specific answer. Basically however it does keep track of what memory it's allocated and depending on how it …

  4. How to correctly use malloc and free memory? - Stack Overflow

    Jul 4, 2014 · I am wondering what is the right/standard way to use malloc and free. Is it needed to set pointer NULL after free? Basically, which of the two following ways is correct? double* …

  5. c - How malloc works? - Stack Overflow

    Possible Duplicate: How do free and malloc work in C? Consider a scenario where i have to allocate some 20 bytes of memory through malloc. For the function call to malloc() to be …

  6. When should I use malloc in C and when don't I? - Stack Overflow

    For that exact example, malloc is of little use. The primary reason malloc is needed is when you have data that must have a lifetime that is different from code scope. Your code calls malloc in …

  7. c - How is malloc () implemented internally? - Stack Overflow

    Sep 16, 2013 · 67 Simplistically malloc and free work like this: malloc provides access to a process's heap. The heap is a construct in the C core library (commonly libc) that allows …

  8. c - What happens when you call free () with a pointer to the …

    The first 4 contains the amount of data you requested (10) and then the return value of the malloc is a pointer to the first byte of unused data in the 14 allocated. When you call free on this …

  9. c - Что такое malloc () ? - Stack Overflow на русском

    Jun 4, 2011 · мне надо использовать в шарпе библиотеку С и функция malloc () прописывается. Я в этом ужасно плохо разбираюсь. А как знать сколько байт памяти …

  10. C Programming: malloc() inside another function - Stack Overflow

    I need help with malloc() inside another function. I'm passing a pointer and size to the function from my main() and I would like to allocate memory for that pointer dynamically using malloc() …