diff -r 986b5d239ee5 -r 3b5b7a4bf446 bounds.c --- a/bounds.c Wed Jan 12 21:54:36 2011 +0100 +++ b/bounds.c Wed Jan 12 21:59:15 2011 +0100 @@ -1,38 +1,39 @@ #include #include +#include extern char etext, edata, end; int main(int argc, char **argv) { - char *step = (char) NULL; + char *step = NULL; char *value_string = "Hallo"; - int value_int = 56; + int value_int = 0x7777; printf("First address beyond:\n"); printf(" program text segment(etext) %10p\n", &etext); printf(" initialized data segment(edata) %10p\n", &edata); printf(" uninitialized data segment (end) %10p\n", &end); - printf(" size: %ld\n", &end - &etext); + printf(" size: %d\n", &end - &etext); printf("-----------------------------------------------\n\n"); - /* - //text bis end ausgeben - for (step = &etext; step <= (&end); step++) { - printf("0x%x: ", step); - putc(*step, stdout); - printf("\n"); + // text bis end ausgeben + for (step = &etext; step < &end; step++) { + printf("%p: ", step); + if (isalnum(*step)) putc(*step, stdout); + else printf("<%02x>", *step); + puts(""); } - */ //alles nach end ausgeben: step = &end; while (1) { - printf("0x%x: ", step); - putc(*step, stdout); - printf("\n"); - step++; + printf("%p: ", step); + if (isalnum(*step)) putc(*step, stdout); + else printf("<%02x>", *step); + puts(""); + step++; } //damit der compiler das nicht weg optimiert