Hello World 2

Table 1.
# Label Memory Address Binary value stored at address Interpretation
# 0x0000 0000 0000 0000 0000 0000 0000 0000 0000 0000...
# ... ... Text Segment
# 0x0000 0FFC0000 0000 0000 0000 0000 0000 0000 0000...
# 0x0000 1000 0000 0000 0000 0000 0000 0000 0000 0000...
# ... ... Data
# 0x0000 1FFC 0000 0000 0000 0000 0000 0000 0000 0000...
# 0x0001 00000000 0000 0000 0000 0000 0000 1000 0000circle2.center.x
# 0x0001 0004 0000 0000 0000 0000 0000 0000 0000 0000circle2.center.y
# 0x0001 0008 0000 0000 0000 0001 0000 0000 0001 0000circle2.alt = 0x0001 0010
# 0x0001 000C 0000 0000 0000 0000 0000 0000 0000 0000circle2.radius
# 0x0001 00100000 0000 0000 0000 0000 0000 0100 0000alt.x
# 0x0001 0014 0000 0000 0000 0000 0000 0000 0100 0000alt.y
# ... ...
# 0x0001 FFFC0000 0000 0000 0000 0000 0000 0000 0000...
# ... ...
# ... ...
#circle2: 0xFFFF EFCC0000 0000 0000 0000 0000 0000 1000 00000x???? ????
#circle1: 0xFFFF EFD00000 0000 0000 0000 0000 0000 1000 0000128
# 0xFFFF EFD4 0000 0000 0000 0000 0000 0000 0100 000064
# 0xFFFF EFD8 0000 0000 0000 0000 0000 0000 0000 0010alt 0x0000 0000
# 0xFFFF EFDC 0000 0000 0000 0000 0000 0000 0000 00102
#c1: 0xFFFF EFE00000 0000 0000 0000 0000 0000 0000 01004
# 0xFFFF EFE4 0000 0000 0000 0000 0000 0000 0000 10008
#y1: 0xFFFF EFE80000 0000 0000 0000 0000 0000 0010 000032
#x1: 0xFFFF EFEC0000 0000 0000 0000 0000 0000 0001 000016
# 0xFFFF EFF0 0000 0000 0000 0000 0000 0000 ???? ????Return address
# 0xFFFF EFF4 1111 1111 1111 1111 1111 1111 1111 ????char** argv = 0x0000 ????
# 0xFFFF EFF8 0000 0000 0000 0000 0000 0000 0000 00100x0000 i.e., int argc
# 0xFFFF EFFC 0000 0000 0000 0000 0000 0000 0000 0000Return value
# ... ...
$ ./hello "Hello world"

hello.c

/*
 *      Coordinates
 *      A program to find the distance between two pairs of coordinates.
 *
 *      Usage: coordinates "x1" "y1" "x2" "y2"
 */

#include 
#include 
#include 
#include 

struct coordinate
{
        int x;
        int y;
};

struct circle
{
        struct coordinate  center;
        struct coordinate* alt;
        int    radius;
};

int main( int argc, char** argv )
{
        int x1 = 16;
        int y1 = 32;

        struct coordinate c1;

        c1.x = 4;
        c1.y = 8;

        struct circle circle1;

        circle1.center.x = 128;
        circle1.center.y = 64;
        circle1.alt      = NULL;
        circle1.radius   = 2;

        struct circle* circle2 = (struct circle*) calloc( 1, sizeof( struct circle ) );

        circle2->alt = (struct coordinate*) calloc( 1, sizeof( struct coordinate ) );

        circle2->center.x = 128;
        circle2->center.y = 128;
        circle2->alt->x   = 64;
        circle2->alt->y   = 64;

        return 0;
}

References