Remove line numbers
From http://web.archive.org/web/20140831121704/http://dirac.org/linux/gdb/02a-Memory_Layout_And_The_Stack.php#investigatingthestackwithgdb.
1 #include2 static void display(int i, int *ptr); 3 4 int main(void) { 5 int x = 5; 6 int *xptr = &x; 7 printf("In main():\n"); 8 printf(" x is %d and is stored at %p.\n", x, &x); 9 printf(" xptr points to %p which holds %d.\n", xptr, *xptr); 10 display(x, xptr); 11 return 0; 12 } 13 14 void display(int z, int *zptr) { 15 printf("In display():\n"); 16 printf(" z is %d and is stored at %p.\n", z, &z); 17 printf(" zptr points to %p which holds %d.\n", zptr, *zptr); 18 }
#includestatic void display(int i, int *ptr); int main(void) { int x = 5; int *xptr = &x; printf("In main():\n"); printf(" x is %d and is stored at %p.\n", x, &x); printf(" xptr points to %p which holds %d.\n", xptr, *xptr); display(x, xptr); return 0; } void display(int z, int *zptr) { printf("In display():\n"); printf(" z is %d and is stored at %p.\n", z, &z); printf(" zptr points to %p which holds %d.\n", zptr, *zptr); }