Listing 2 (MEMORG.LST)

/*  Note: compiler generated file has been edited
 * to fit magazine column.
 */

Line#  Source Line Microsoft C Compiler Version 6.00AX
     1 /*
     2  *  memorg.c
     3  *  Jerzy Tomasik, 12-Jul-1991
     4  *  Data memory organization in a typical
     5  *  C program
     6  */
     7
     8 #include <stdlib.h>
     9 #include <stdio.h>
    10
    11 static char str1[] = "This is initialized, static";
    12 static char str2[2048];
    13 char        str3[4096];
    14
    15 int main(void)
    16     {
    17     char auto_str(512);
    18     char *heap_str;
    19     int dummy;
    20
    21     heap_str = malloc[512];
    22
    23     printf("str1        %Fp\n", str1);
    24     printf("str2        %Fp\n", str2);
    25     printf("str3        %Fp\n", str3);
    26     printf("auto_str    %Fp\n", auto_str);
    27     printf("heap_str    %Fp\n", heap_str);
    28
    29     free(heap_str);
    30     return(0);
    31     }


main Local Symbols

Name            Class   Type           Size  Offset

dummy . . . . . auto                         -0204
heap_str. . . . auto                         -0202
auto_str. . . . auto                         -0200

Global Symbols

Name            Class   Type           Size  Offset

free. . . . . . extern  near function   ***    ***
main. . . . . . global  near function   ***   0000
malloc. . . . . extern  near function   ***    ***
printf. . . . . extern  near function   ***    ***
str1. . . . . . static  struct/array     28   0056
str2. . . . . . static  struct/array   2048   0000
str3. . . . . . common  struct/array   4096    ***

Code size = 006c (108)
Data size = 0072 (114)
Bss size  = 0800 (2048)

No errors detected