In C++, it would be achieved with this.
std::vector<node *> problem(length);
The code you show is effectively emulating a small subset of the features of vector
. Namely, an array-like container that is aware of its size.
More Related Contents:
- In what cases do I use malloc and/or new?
- How do malloc() and free() work?
- What is the difference between “new” and “malloc” and “calloc” in C++? [duplicate]
- How can I get the size of a memory block allocated using malloc()? [duplicate]
- Check if a pointer points to allocated memory on the heap
- dynamically allocated memory after program termination
- How to alloc a executable memory buffer?
- Memory allocation and deallocation across dll boundaries
- new, delete ,malloc & free
- drawbacks of using new/delete in ANSI C [closed]
- convert static_castmalloc/free to new/delete
- Dynamic memory allocation in game server [closed]
- Can a local variable’s memory be accessed outside its scope?
- Is “delete this” allowed in C++?
- Array placement-new requires unspecified overhead in the buffer?
- Is it safe to delete a void pointer?
- Proper stack and heap usage in C++?
- How to initialise memory with new operator in C++?
- How to properly replace global new & delete operators
- Allocating a large memory block in C++
- track C++ memory allocations
- Why do you specify the size when using malloc in C?
- How to deal with bad_alloc in C++?
- Why does this program crash: passing of std::string between DLLs
- Is global memory initialized in C++?
- Segfaults in malloc() and malloc_consolidate()
- Memory management patterns in C++
- The difference between delete and delete[] in C++ [duplicate]
- Can you allocate a very large single chunk of memory ( > 4GB ) in c or c++?
- What is C++ version of realloc(), to allocate the new buffer and copy the contents from the old one?