Files
CS3841/Examples/proclayout.c
p-w-rs 5c5b03b6e0 stuff
2022-09-08 09:53:32 -05:00

20 lines
462 B
C

/*
* 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;
}