This commit is contained in:
p-w-rs
2022-09-08 09:53:32 -05:00
parent 5cfe037476
commit 5c5b03b6e0
10 changed files with 20 additions and 0 deletions

20
Examples/proclayout.c Normal file
View File

@@ -0,0 +1,20 @@
/*
* proclayout.c - Prints the location of variables stored
* at different locations in a process's
* address space
*/
#include <stdio.h> // needed for printf
#include <stdlib.h> // needed for malloc, free
int i = 0;
int main()
{
int j = 0;
int *k = malloc(sizeof(int));
printf("&main = %p\n", main);
printf("&i = %p\n", &i);
printf("k = %p\n", k);
printf("&j = %p\n", &j);
free(k);
return 0;
}