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

    Size malloc allows you to allocate much larger memory spaces than the one allocated simply using student p; or int x[n];. The reason being malloc allocates the space on heap while the …

  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. What are some useful examples of malloc() in C? - Stack Overflow

    Jan 29, 2012 · malloc is used in C to allocate stuff on the heap - memory space that can grow and shrink dynamically at runtime, and the ownership of which is completely under the …

  4. c - alloc, malloc, and alloca — What's the difference? - Stack …

    Sep 21, 2015 · The Microsoft Visual C++ runtime includes an Alloc() function which is somewhat similar to malloc(), but this is also not part of the C standard. malloc() allocates memory on the …

  5. 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 …

  6. malloc - Allocating memory for a Structure in C - Stack Overflow

    Mar 15, 2012 · I'm tasked to create a program which dynamically allocates memory for a structure. normally we would use x=malloc(sizeof(int)*y); However, what do I use for a …

  7. 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() …

  8. c - malloc implementation? - Stack Overflow

    Mar 24, 2011 · I'm trying to implement malloc and free for C, and I am not sure how to reuse memory. I currently have a struct that looks like this: typedef struct _mem_dictionary { void …

  9. malloc for struct and pointer in C - Stack Overflow

    malloc for struct and pointer in C Asked 12 years, 10 months ago Modified 2 years, 11 months ago Viewed 432k times

  10. c - How do I use malloc properly? - Stack Overflow

    Nov 24, 2011 · How would I use malloc to allocate that much memory for whatever is going to be in there? I've tried reading up on malloc, but even K&R did not seem to have much info on it.