Yesterday I fell upon an awkward question and would love for some help!
If I allocate a dynamic pointer in c in Visual Studio, then free it, I saw that the memory is then changed to "dd dd dd dd dd dd dd dd". I was taught when memory is freed, it is not set or changed by the operating system but only set as "unused memory" that the system can allocate again and overwrite.
Code:
int* x = (int*)malloc(sizeof(int) * 2);
*x = 1;
*(x + 1) = 2;
free(x);
would love for some help with understanding whats going on and why this is acting like it is, have provided some before/after pictures down bellow.
Thanks for the help!!