+ 1
Is it possible to change a element position from stack memory to heap memory if so, then how?
Just a curiosity to know if we can change position of memory or have some fun in memory management
2 Answers
+ 2
venkat bhnala
Generally any variable is first came in ram is stored in stack. To allocate in heap memory area you can use malloc() function.
size_t bufsize = 1024;
char *a;
a = malloc(bufsize * sizeof(char));
Can be an good examples for managing memory.
+ 1
Thanks is it possible to transfer elements stored in stack to heap coz mallac can only give u space in run time isn't it