1 2 3 4 5 6 7 8 9 10

/*

The previous is a procedure called "look" that prints 8 lines of output. Each line has a single number that is the address of a different parameter--coerced from an unsigned int to an int and printed in hexadecimal (%x)

*/

int main (void) {
static int a = 1;
static int b = 2;
static char c = '3';
static char d = '4';
static double f = 5.0;
static double g = 6.0;

/* 4 bytes of space */

/* 1 byte of space */

/* 8 bytes of space */

printf ("The address of a is %x\n", (int) &a); printf ("The address of b is %x\n", (int) &b); printf ("The address of c is %x\n", (int) &c); printf ("The address of d is %x\n", (int) &d); printf ("The address of f is %x\n", (int) &f); printf ("The address of g is %x\n", (int) &g);

look (a, b, c, d, f, g);
return (0);
}
produces output like

The address of a is 40b0 The address of b is 40b4 The address of c is 40b8 The address of d is 40b9 The address of f is 40c0 The address of g is 40c8

why not 40ba ?

January 22, 1999

Page 9

copyright UoA