Am I typing this wrong?
#include <stdio.h>
#include <stdlib.h>
int
main( void )
{
int * p = malloc(100000);
int * q;
printf("%p\n%p\n", (void *)p, (void *)q);
(void)getchar();
free(p);
return 0;
}
I execute it sequentially or on several terminals at the same time, it always prints "0x60aa00000800" for p( qdiffers, however).
EDIT: Thanks for the answers, one of the reasons I was confused was that he printed different addresses each time. It turns out that the new version of the compiler that I started using -fsanitize=address, caused this change. Oops
source
share