Created
January 5, 2021 13:32
-
-
Save emadflash/473af94c54e766b77f3874609ed01ea3 to your computer and use it in GitHub Desktop.
memory segmentation in c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<stdlib.h> | |
/* | |
* text/code section | |
* data - initialized var | |
* bss - un-initialized var | |
* heap - memory allocated | |
* stack - functions | |
*/ | |
// DATA | |
static global_initialized_var = 1; | |
// BSS | |
int global_uninitialized_var; | |
int main(){ | |
// STACK | |
static int initialized_var = 1; | |
// HEAP | |
int* heap_var_ptr = (int*) malloc(4); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment