$ gcc -g temp.c $ gdb a.out GNU gdb (GDB) 7.1-ubuntu Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i486-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /home/minimonk/src/temp/a.out...done. (gdb) run Starting program: /home/minimonk/src/temp/a.out
Program received signal SIGSEGV, Segmentation fault. 0x080483d8 in main () at temp.c:8 8 str1[1] = 'x'; (gdb) print &str1[0] $5 = 0x80484b0 "abcdef" (gdb) print &str2[0] $6 = 0xbffff6ed "ABCDEF" (gdb)