how to count all pointers and variables that using an dynamically allocated memory with malloc and new ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how to count all pointers and variables that using an dynamically allocated memory with malloc and new ?

if we override malloc and new function we can track first created pointer . but how can i track and count other pointers and functions that using this allocated memory ? should i override Assignment operator and function call ? if yes how ?

26th Jun 2022, 5:36 PM
Esmaeil Zivari
Esmaeil Zivari - avatar
1 Answer
0
An inbuilt function malloc is used to dynamically assign memory to pointers. This function is available in stdlib. h header file. The memory needed for the pointer is given as argument to this function and malloc allocates that much memory block to the pointer variable.
26th Jun 2022, 6:00 PM
CoMpUtOr/ScIeNtiSt
CoMpUtOr/ScIeNtiSt - avatar