Skip to content

Instantly share code, notes, and snippets.

@AlexsJones
Last active August 29, 2015 13:56
Show Gist options
  • Save AlexsJones/9054489 to your computer and use it in GitHub Desktop.
Save AlexsJones/9054489 to your computer and use it in GitHub Desktop.
Memory mapping layout explained
/*
* =====================================================================================
*
* Filename: main.c
*
* Description:
*
* Version: 1.0
* Created: 02/17/14 07:56:15
* Revision: none
* Compiler: gcc
*
* Author: jonesax (),
* Organization:
*
* =====================================================================================
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
const char *pp = "DATA SEGMENT";
void out() //TEXT SEGMENT
{
printf("%s\n",pp);
char p[6] = { 'S','T','A','C','K'};
printf("%s\n",p);
char *ppp = malloc(sizeof(char) * 5);
memcpy(ppp,"HEAP",4);
printf("%s\n",ppp);
}
int main(int argc, char **argv)
{
out(); //TEXT SEGMENT
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment