mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-08-01 06:50:26 +02:00
Change to the correct data type (#4343)
This commit is contained in:
committed by
GitHub
parent
3b7e5d5ce2
commit
5cff162a94
@@ -22,7 +22,7 @@ For example, this code will not have a memory leak:
|
||||
#include <memory>
|
||||
|
||||
void no_memory_leak() {
|
||||
std::shared_ptr<int> ptr = std::make_shared<int[]>(100); // Allocating memory in the heap for an array of integers using shared_ptr
|
||||
std::shared_ptr<int[]> ptr = std::make_shared<int[]>(100); // Allocating memory in the heap for an array of integers using shared_ptr
|
||||
// Some code...
|
||||
} // shared_ptr goes out of scope and it will automatically deallocate the memory block assigned to it.
|
||||
```
|
||||
```
|
||||
|
Reference in New Issue
Block a user