You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
665 B
C

5 years ago
#include <stdio.h>
#include <stdlib.h>
// code segment - program text
// constant segment - immutable values. *s for example.
// globals - global variables or local variables marked 'static'
// heap - memory allocated at runtime. Grows towards the top virtual address space
// stack - sequence of stack frames. Grows from the top of the virtual-address space
int global;
int main(){
int local = 5;
void *p = malloc(128);
char *s = "Hello, World";
printf("Address of main is %p\n", main);
printf("s points to %p\n", s);
printf("Address of global is %p\n", &global);
printf("Address of local is %p\n", &local);
printf("p points to %p\n", p);
return 0;
}