DEV Community

Discussion on: Is there a way to convert dynamically allocated memory to static memory OR copy ptr contents in C/C++?

Collapse
 
johnmper profile image
João Pereira

AFIK, you cannot convert dynamic memory in static or stack memory since both need to be known at compile time. You can move it into static memory but you would still need a buffer with a constant size to be prepared at compile time. Which means it won't be a "new" static memory