Apps: Use the new %p in printf()

This commit is contained in:
apio 2022-10-08 18:11:41 +02:00
parent 3ee1f34bc4
commit 40099feb80
2 changed files with 2 additions and 2 deletions

View File

@ -28,7 +28,7 @@ int main()
{ {
char* variable = malloc(200); char* variable = malloc(200);
*variable = 3; *variable = 3;
printf("Allocated variable at address %lx\n", (unsigned long int)variable); printf("Allocated variable at address %p\n", variable);
free(variable); free(variable);
} }

View File

@ -12,7 +12,7 @@ int main()
sleep(1); sleep(1);
void* allocated = malloc(CHUNK); void* allocated = malloc(CHUNK);
do { do {
printf("Allocating 4 MB of memory... %lx\n", (unsigned long)allocated); printf("Allocating 4 MB of memory... %p\n", allocated);
sleep(1); sleep(1);
} while ((allocated = malloc(CHUNK))); } while ((allocated = malloc(CHUNK)));
perror("malloc"); perror("malloc");