About 2,770,000 results
Open links in new tab
  1. How can I allocate memory and return it (via a pointer-parameter) …

    It also makes the code read a little better IMO. Isolate memory management functions behind higher-level allocate and deallocate functions; these can handle not only allocation but also …

  2. What are all the ways to allocate memory in C and how do they …

    Sep 25, 2010 · 13 malloc allocates memory. The contents of the memory are left as-is (filled with whatever was there before). calloc allocates memory and sets its contents to all-zeros.

  3. How to dynamically allocate arrays in C++ - Stack Overflow

    Feb 21, 2016 · 2 In C++ we have the methods to allocate and de-allocate dynamic memory.The variables can be allocated dynamically by using new operator as,

  4. Allocate memory and save string in c - Stack Overflow

    Dec 22, 2011 · After thinking about it my assumption was that first i allocate space for 12 chars in memory but the assignment in the next line creates a char array on the stack and the memory …

  5. arrays - Why allocate memory? (C++) - Stack Overflow

    Jun 22, 2011 · I am trying to understand memory allocation in C++. A question that comes to my mind is why is it so necessary to allocate memory? And what happens if we use memory …

  6. c++ - Dynamically allocate memory for struct - Stack Overflow

    Feb 22, 2012 · When you dynamically allocated memory for a struct you get a pointer to a struct. Once you are done with the Student you also have to remember to to release the dynamically …

  7. C++ How to allocate memory dynamically on stack?

    Jun 13, 2011 · Is there a way to allocate memory on stack instead of heap? I can't find a good book on this, anyone here got an idea?

  8. c++ - Memory Allocation/Deallocation? - Stack Overflow

    Mar 16, 2015 · new and delete Typically, you should not need to use the allocation and deallocation functions directly because they only give you uninitialised memory. Instead, in …

  9. How to dynamically allocate memory in Python - Stack Overflow

    Jun 24, 2016 · Is there any method in python, that I can use to get a block of memory from the heap ,and use a variable to reference it. Just like the keyword "new" , or the function malloc() …

  10. Why do you need to allocate memory in c/c++? - Stack Overflow

    Nov 17, 2018 · 4) The main reason to "dynamically" allocate memory is so you can control the life span of the object. If you let the language do it the life span of an object is pre-defined (and …